Click here to Skip to main content
15,887,027 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to manage a combined role + organization security in MVC? Pin
F Margueirat20-Aug-18 7:00
F Margueirat20-Aug-18 7:00 
GeneralRe: How to manage a combined role + organization security in MVC? Pin
jkirkerx20-Aug-18 7:23
professionaljkirkerx20-Aug-18 7:23 
QuestionBrowser Security Pin
saurabh.15in14-Aug-18 3:39
saurabh.15in14-Aug-18 3:39 
AnswerRe: Browser Security Pin
Richard Deeming14-Aug-18 4:15
mveRichard Deeming14-Aug-18 4:15 
GeneralRe: Browser Security Pin
saurabh.15in15-Aug-18 21:28
saurabh.15in15-Aug-18 21:28 
QuestionI am getting the following error in my Production Server: Error Message: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state. Pin
indian14313-Aug-18 7:59
indian14313-Aug-18 7:59 
AnswerRe: I am getting the following error in my Production Server: Error Message: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state. Pin
Richard Deeming13-Aug-18 8:10
mveRichard Deeming13-Aug-18 8:10 
QuestionAsp.Net Core 2.1 with Angular 6 inside, Angular 6 service adding record using .net controller, what to return?, and use of MongoDB with auto increment Pin
jkirkerx13-Aug-18 7:58
professionaljkirkerx13-Aug-18 7:58 
Well I've made it this now, which is pretty good. I've almost completed the porting over the front end of my portfolio website and I'm working with the database now, in which I chose MongoDB since that seems to be the buzz word for job apps.

A couple I don't understand about MongoDB. Guess the first question is the auto increment for the index column. Guess Mongo uses a unique identifier based on some other logic, so I used ObjectId.GenerateNewId(); Below is an example of my controller code which writes to Mongo successfully. see the CRMMessage;

Q1: Should I just get rid of the "Id" which was int and is now string and just use InternalId? Or does MongoDB have the same mechanism that will auto increment?

So before I added the the respository to the controller function, it worked fine. Angular would register a success and run my success code. But now it returns something I can't see, which results in Error 500 according to Chrome F12.

Q2: Should I just change IActionResult to void and return nothing? I'm lost here on this.
[HttpPost]
public IActionResult AddMessage([FromBody] CRMMessage message)
{
    if (message == null)
    {
        return BadRequest();
    }

    if (!ModelState.IsValid)
    {
        return BadRequest(ModelState);
    }

    _crmRespository.AddMessage(new CRMMessage
    {
        // Id = "0",
        InternalId = ObjectId.GenerateNewId(),
        Name = message.Name,
        CompanyName = message.CompanyName,
        EmailAddress = message.EmailAddress,
        PhoneNumber = message.PhoneNumber,
        PhoneMobile = message.PhoneMobile,
        TimeZone = message.TimeZone,
        TimeStamp = message.TimeStamp,
        UpdatedOn = message.TimeStamp,
        Message = message.Message,
        RememberMe = message.RememberMe
    });

    return CreatedAtRoute("GetSingleMessage", new { id = message.Id }, message);

}

This is my Angular 6, TypeScript onSubmit Function. I know this question is in the wrong section bought thought I'd ask anyways since it tied together. I wonder how it knows the difference between a success and an error. There are tools like postman in which I need to learn how to use.Confused | :confused:
onSubmit() {
this.dataService.addMessage(this.model).subscribe(
    () => {

        this.messageSuccess = true;
        this.getStartedForm.reset();

        this.model.name = '';
        this.model.companyName = '';
        this.model.emailAddress = ''
        this.model.phoneNumber = '';
        this.model.phoneMobile = '';
        this.model.message = '';

        // Set the alert message on the Contact Page<br />
        setTimeout(() => {
            this.messageSuccess = false;
            this.getStartedModal.hide();
            this.router.navigate(['/home/getStarted']);<br />
        }, 3000);
    },
    error => {
        console.log(error);
    }

);

My Angular journey has been confusing because there are so many different examples and versions of Angular. I'm actually dual developing between a pure Angular 6 app in cli and this .Net Core 2.1 version so I can see the different between the two, determine which info is correct. Angular 6 using cli and ng on a text editor is more straight forward to learn first.

Any thoughts besides giving up would be appreciated.
If it ain't broke don't fix it
Discover my world at jkirkerx.com

Answer[Solved the CreatedAtRoute] Pin
jkirkerx13-Aug-18 8:43
professionaljkirkerx13-Aug-18 8:43 
QuestionUsing Elmah for my ASP.Net MVC application Pin
indian14312-Aug-18 22:08
indian14312-Aug-18 22:08 
QuestionI am creating graph chart line chart bar chart in asp.net web form. Pin
Member 1389651512-Aug-18 20:04
Member 1389651512-Aug-18 20:04 
AnswerRe: I am creating graph chart line chart bar chart in asp.net web form. Pin
Richard MacCutchan12-Aug-18 21:01
mveRichard MacCutchan12-Aug-18 21:01 
QuestionThe remote name could not be resolved Pin
Member 102909889-Aug-18 1:10
Member 102909889-Aug-18 1:10 
AnswerRe: The remote name could not be resolved Pin
Richard Deeming9-Aug-18 1:42
mveRichard Deeming9-Aug-18 1:42 
AnswerRe: The remote name could not be resolved Pin
Nathan Minier9-Aug-18 2:23
professionalNathan Minier9-Aug-18 2:23 
QuestionSetting onblur, onkeyup and onkeydown for @Html.Kendo().TextBoxFor using HtmlAttributes Pin
indian1438-Aug-18 14:34
indian1438-Aug-18 14:34 
AnswerRe: Setting onblur, onkeyup and onkeydown for @Html.Kendo().TextBoxFor using HtmlAttributes Pin
jkirkerx13-Aug-18 8:10
professionaljkirkerx13-Aug-18 8:10 
GeneralRe: Setting onblur, onkeyup and onkeydown for @Html.Kendo().TextBoxFor using HtmlAttributes Pin
jkirkerx18-Aug-18 8:28
professionaljkirkerx18-Aug-18 8:28 
QuestionGetting HiddenField value in GetValidators method of CustomModelValidatorProvider Pin
indian1437-Aug-18 11:28
indian1437-Aug-18 11:28 
AnswerRe: Getting HiddenField value in GetValidators method of CustomModelValidatorProvider Pin
Eric W Scott8-Aug-18 3:59
professionalEric W Scott8-Aug-18 3:59 
GeneralRe: Getting HiddenField value in GetValidators method of CustomModelValidatorProvider Pin
indian1438-Aug-18 6:30
indian1438-Aug-18 6:30 
GeneralRe: Getting HiddenField value in GetValidators method of CustomModelValidatorProvider Pin
Eric W Scott9-Aug-18 4:16
professionalEric W Scott9-Aug-18 4:16 
QuestionHow to solve HTTP Error 403.14 - Forbidden error in web service project Pin
sudipta saha6-Aug-18 1:24
sudipta saha6-Aug-18 1:24 
AnswerRe: How to solve HTTP Error 403.14 - Forbidden error in web service project Pin
Richard Deeming6-Aug-18 2:21
mveRichard Deeming6-Aug-18 2:21 
GeneralRe: How to solve HTTP Error 403.14 - Forbidden error in web service project Pin
sudipta saha6-Aug-18 22:31
sudipta saha6-Aug-18 22:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.