When I send some data in the database and the text is successful, it should be notified and if there is an error, it should give a mistake.
The message must be displayed on Create or Login, but it depends on whether it is succe or error.
AccountViews model = new AccountViews();
var mail = model.Email;
var result = _dbContext.Users.FirstOrDefault(i => i.Brugernavn == mail);
if(result == null)
{
model.Message = "Succes";
return RedirectToAction("Login");
}
model.Message = "Error";
return RedirectToAction("Create");
In my model I have:
[TempData]
public string Message { get; set; }
public bool ShowMessage => !string.IsNullOrEmpty(Message);
Then the question here is how can I get my message to appear?
The problem is, as I see it, that how I get my message to appear on the page when I send me / someone over to another page.
I work in MVC - .Net core 2.0