public IActionResult Edit(int?id) { var user = new data.Model.TblUser(); if (id > 0) { data.Service.UserService userService = new data.Service.UserService(); user = userService.GetById(id.Value); } return(View(user)); }
public IActionResult Edit(data.Model.TblUser data) { var user = new data.Model.TblUser(); data.Service.UserService userService = new data.Service.UserService(); if (data.Id > 0) { userService.Update(data); } else { userService.Insert(data); } return(RedirectToAction("Index")); }