public ActionResult Login(User entity) { UserService userService = new UserService(); var temp = userService.GetData(entity.UserName, entity.Password); if(temp != null) { SessionUser.Current = new SessionUser() { EmailAdd = temp.Email, ImageName = temp.ImageName, Name = temp.Name, UserID = temp.UserId, UserName = temp.UserName }; return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", "Kullanıcı adı veya şifre geçersiz!"); return RedirectToAction("Index", "Login"); } }
public void Delete(User entity) { if (entity.UserName != "admin") { db.Users.Remove(entity); db.SaveChanges(); } }
public void Update(User entity) { db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public void Create(User entity) { db.Users.Add(entity); db.SaveChanges(); }