public async Task <IActionResult> Create_Or_Update(MotorLifts inputModel) { try { if (string.IsNullOrEmpty(inputModel.Name)) { throw new Exception($"Tên {MessageConst.NOT_EMPTY_INPUT}"); } if (inputModel.Id == 0) { inputModel.CreatedDate = DateTime.Now; await _motorLiftsManager.Create(inputModel); return(Json(new { Result = true, Message = "Thêm mới dữ liệu thành công" })); } else { await _motorLiftsManager.Update(inputModel); return(Json(new { Result = true, Message = "Cập nhật dữ liệu thành công" })); } } catch (Exception ex) { return(Json(new { Result = false, Message = ex.Message })); } }
public async Task Update(MotorLifts inputModel) { try { await _unitOfWork.MotorLiftsRepository.Update(inputModel); await _unitOfWork.SaveChange(); } catch (Exception ex) { throw ex; } }