public ActionResult Login(User model) { var iden = new ClaimsIdentity("Google"); iden.AddClaim(new Claim(ClaimTypes.Email, model.Email)); iden.AddClaim(new Claim(ClaimTypes.Role, "Admin")); //var identity = _usermanager.CreateIdentity(model, DefaultAuthenticationTypes.ApplicationCookie); Authentication.SignIn(iden); return View(model); }
public ActionResult Create(User user) { try { //TODO: Add insert logic here userRepository.InsertUser(user); userRepository.Save(); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Register(User model) { //TODO :implement some validation return View(model); }
public ActionResult EditPost(int id,User user) { try { // TODO: Add update logic here userRepository.UpdateUser(user); userRepository.Save(); //if (TryUpdateModel(user)) //{ // dbContext.SaveChanges(); //} return RedirectToAction("Index"); } catch { return View(); } }
public void UpdateUser(User user) { context.Entry(user).State = EntityState.Modified; }
public void InsertUser(User user) { context.Users.Add(user); }