public ActionResult Create(UserModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var user = ModelMapper.GetUser(model);
                    userService.AddNewUser(user);
                    return RedirectToAction("Index");
                }

                return View(model);
            }
            catch
            {
                return View(model);
            }
        }
 public ActionResult Edit(UserModel model)
 {
     try
     {
         var user = ModelMapper.GetUser(model);
         userService.UpdateUser(user);
         return RedirectToAction("Index");
     }
     catch
     {
         return View(model);
     }
 }
        public static User GetUser(UserModel model)
        {
            if (model == null)
                return null;

            return new User()
            {
                Id = model.Id,
                FirstName = model.FirstName,
                LastName = model.LastName,
                UserName = model.UserName,
                Password = model.Password,
                NICNumber = model.NICNumber,
                IsActiveUser = model.IsActiveUser,
                RoleName = model.RoleName,
                RoleId = (int)model.Role,
                DateAdded = model.DateAdded
            };
        }