public ActionResult TriggerUser(int id) { try { var user = dbContext.Users.FirstOrDefault(f => f.UserId == id); if (user.IsBlocked) { user.IsBlocked = false; } else { user.IsBlocked = true; } dbContext.SaveChanges(); return(RedirectToAction("Index", "Administrator")); } catch (Exception e) { return(RedirectToAction("Index", "Administrator")); } }
public ActionResult UserRegistration(User user) { try { user.CreationDate = DateTime.Now; dbContext.Users.Add(user); dbContext.SaveChanges(); return(View("Login")); } catch { return(HttpNotFound()); } }