public ActionResult <CommonResponeModel> Update(EmployeeDayOffRequest request) { var result = 0; var model = request.MapTo <EmployeeDayOff>(); var currentObj = this._employeeDayOffRepository.GetItemById(model.Id); if (currentObj != null) { model.InitBeforeSave(RequestUsername, InitType.Update); result = this._employeeDayOffRepository.Update(model); } else { Result = new ErrorResult(ActionType.Select, CommonMessageGlobal._404); } if (result > 0) { Result = new SuccessResult(ActionType.Edit, AppGlobal.SaveChangeSuccess); } else { Result = new ErrorResult(ActionType.Edit, AppGlobal.SaveChangeFalse); } return(GetCommonRespone()); }
public ActionResult <CommonResponeModel> Create(EmployeeDayOffRequest request) { var result = 0; var model = request.MapTo <EmployeeDayOff>(); model.InitBeforeSave(RequestUsername, InitType.Create); result = this._employeeDayOffRepository.Insert(model); if (result > 0) { Result = new SuccessResult(ActionType.Insert, AppGlobal.SaveChangeSuccess); } else { Result = new ErrorResult(ActionType.Insert, AppGlobal.SaveChangeFalse); } return(GetCommonRespone()); }