public async Task <IActionResult> AddUser() { string email = HttpContext.Request.Form["email"]; string name = HttpContext.Request.Form["Name"]; string surname = HttpContext.Request.Form["Surname"]; string login = HttpContext.Request.Form["Login"]; string password = HttpContext.Request.Form["Password"]; string userTyp = HttpContext.Request.Form["userTyp"]; using (var context = new RealEstateOfficeContext()) { var usr = new Domain.User(); usr.Emailaddress = email; usr.Name = name; usr.Surname = surname; usr.Login = login; usr.Password = UserDatabaseContext.codePassword(password); usr.UserType = Convert.ToInt32(userTyp); context.Add(usr); await context.SaveChangesAsync(); } return(RedirectToAction("Index", "Users")); }