public ActionResult Edit(User user)
 {
     if (ModelState.IsValid)
     {
         user.PublicIP = Utility.GetPublicIP();
         user.Password = Cryption.EncryptText(user.Password);
         userRepo.Update(user);
         userRepo.Save();
         return Json(new { success = true });
     }
     return PartialView("Edit", user);
 }
        public JsonResult Create(User user)
        {
            if (ModelState.IsValid)
            {
                var isUserRegistered = userRepo.FindById(user.UserId);
                if (isUserRegistered != null)
                    return Json("Girmiş olduğunuz email adresi zaten sistemde kayıtlıdır.");

                user.PublicIP = Utility.GetPublicIP();
                user.Password = Cryption.EncryptText(user.Password);
                user.CreatedBy = Request.Cookies["USER"].Value;
                user.CreationDate = DateTime.Now;
                userRepo.Insert(user);
                userRepo.Save();
                return Json(new { success = true });
            }
            return Json(user, JsonRequestBehavior.AllowGet);
        }
 public void Update(User entity)
 {
     context.Entry(entity).State = System.Data.Entity.EntityState.Modified;
 }
 public void Delete(User entity)
 {
     User user = context.Users.Find(entity.UserId);
     context.Users.Remove(user);
 }
 public void Insert(User entity)
 {
     context.Users.Add(entity);
 }