예제 #1
0
        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");
            }
        }
예제 #2
0
 public void Delete(User entity)
 {
     if (entity.UserName != "admin")
     {
         db.Users.Remove(entity);
         db.SaveChanges();
     }
 }
예제 #3
0
 public void Update(User entity)
 {
     db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
 }
예제 #4
0
 public void Create(User entity)
 {
     db.Users.Add(entity);
     db.SaveChanges();
 }