public ActionResult <CommonResponeModel> Update(EmployeeRelativeRequest request) { var result = 0; var model = request.MapTo <EmployeeRelative>(); var currentObj = this._employeeRelativeRepository.GetItemById(model.Id); if (currentObj != null) { model.InitBeforeSave(RequestUsername, InitType.Update); result = this._employeeRelativeRepository.Update(model); } else { Result = new ErrorResult(ActionType.Select, "Lỗi 404"); } if (result > 0) { Result = new SuccessResult(ActionType.Insert, AppGlobal.SaveChangeSuccess); } else { Result = new ErrorResult(ActionType.Insert, AppGlobal.SaveChangeFalse); } return(GetCommonRespone()); }
public ActionResult <CommonResponeModel> Create(EmployeeRelativeRequest request) { var result = 0; var model = request.MapTo <EmployeeRelative>(); model.InitBeforeSave(RequestUsername, InitType.Create); result = this._employeeRelativeRepository.Insert(model); if (result > 0) { Result = new SuccessResult(ActionType.Insert, AppGlobal.SaveChangeSuccess); } else { Result = new ErrorResult(ActionType.Insert, AppGlobal.SaveChangeFalse); } return(GetCommonRespone()); }