public ActionResult Edit(long id)
        {
            using (DBEntities db = new DBEntities())
            {
                UsersRepository uRepo = new UsersRepository();
                var user = uRepo.ReadAll().FirstOrDefault(u => u.UserID == id);

                user.Password = SecurityUtils.DecryptCypher(user.Password);

                return View(user);
            }
        }
        public ActionResult Edit(UsersExt model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    UsersRepository uRepo = new UsersRepository();
                    if (uRepo.Update(model, ModelState, this))
                    {
                        return RedirectToAction("Index", "Users");
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", "Error: Please Correct/Enter All the Information below to Save this Record, All Fields are Mandatory");
                    ErrorHandling.HandleModelStateException(ex, ModelState);
                }
            }

            return View(model);
        }
        public ActionResult _Destroy([DataSourceRequest]DataSourceRequest request, UsersExt userExt)
        {
            using (DBEntities db = new DBEntities())
            {
                try
                {
                    UsersRepository uRepo = new UsersRepository();
                    uRepo.Delete(userExt, this);
                }
                catch (Exception ex)
                {
                    ErrorHandling.HandleModelStateException(ex, ModelState);
                    ErrorHandling.SetErrorCode(ex);
                    throw new Exception("");
                }
            }

            return Json(request);
        }
 public ActionResult _Read([DataSourceRequest]DataSourceRequest request)
 {
     UsersRepository uRepo = new UsersRepository();
     DataSourceResult result = uRepo.ReadAll().ToDataSourceResult(request);
     return Json(result);
 }