public ActionResult <InformUpdateResViewModel> Manage_OpinionInfo_Update(InformUpdateViewModel informUpdateViewModel) { int Inform_Update_Count; Inform_Update_Count = _informService.UpdateInform(informUpdateViewModel); var Actionresult = _informFactory.GetInformUpdateResViewModel(); if (Inform_Update_Count > 0) { Actionresult.baseViewModel.IsSuccess = true; Actionresult.UpdateCount = Inform_Update_Count; Actionresult.baseViewModel.Message = "更改成功"; Actionresult.baseViewModel.ResponseCode = 200; _ILogger.Information("更改通知信息成功"); return(Ok(Actionresult)); } else { Actionresult.baseViewModel.IsSuccess = false; Actionresult.UpdateCount = 0; Actionresult.baseViewModel.Message = "更改失败"; Actionresult.baseViewModel.ResponseCode = 400; _ILogger.Information("更改通知信息失败"); return(BadRequest(Actionresult)); } }
public int UpdateInform(InformUpdateViewModel informUpdateViewModel) { var updateModel = _IMapper.Map <InformUpdateViewModel, Inform>(informUpdateViewModel); _informRepository.Update(updateModel); return(_informRepository.SaveChanges()); }