public ActionResult CreateAndEdit(RegisterAccountViewModel objRegister)
        {
            try
            {
                Validate(objRegister);
                if (ModelState.IsValid)
                {
                    Mapper.CreateMap<RegisterAccountViewModel,User>();
                    var objSave = Mapper.Map<User>(objRegister);
                    objSave.PassWord = Hashing.HashPassword(objSave.PassWord);
                    db.Users.Add(objSave);

                    //Update
                    if(objRegister.UserId > 0)
                        db.Entry(objSave).State = EntityState.Modified;
                    db.SaveChanges();

                    string url = Url.Action("RenderListUser", "UserManagement");
                    return Json(new { success = true, url = url });
                }

                return PartialView("NewUserPatial", objRegister);

            }
            catch (Exception ex)
            {
                objRegister.Message = ex.ToString();
                return PartialView("NewUserPatial", objRegister);
            }
        }
 public ActionResult Edit(int id)
 {
     try
     {
         var obj = db.Users.First(o => o.UserId == id);
         Mapper.CreateMap<User,RegisterAccountViewModel>();
         var objReturn = Mapper.Map<RegisterAccountViewModel>(obj);
         objReturn.PassWord = string.Empty;
         return PartialView("NewUserPatial", objReturn);
     }
     catch (Exception ex)
     {
         var objReturn = new RegisterAccountViewModel() {Message = ex.ToString()};
         return PartialView("NewUserPatial", objReturn);
     }
 }