public void SettleAccident(SettleQualityAccidentInput input) { var existing = _accidentRepository.Get().Include(u => u.SettlementPhotoSets).Where(u => u.Id == input.Id).FirstOrDefault(); var accident = input.MapTo <QualityAccident>(); accident.DisposalState = DisposalState.Completed; _accidentRepository.Update(accident, existing, new System.Linq.Expressions.Expression <Func <QualityAccident, object> >[] { u => u.SettlementTime, u => u.DisposalState, u => u.SettlementPhotoSets }); AppBaseContext.Instance.Produce("add-project-briefing", JsonConvert.SerializeObject(new { TenantId = _op.TenantId, ProjectId = existing.ProjectId })); //if (accident.SettlementPhotoSet!= null) //{ // accident.SettlementPhotoSet.Category = "质量事故"; // accident.SettlementPhotoSet.ProjectId = _accidentRepository.Get(accident.Id).ProjectId; //} //_accidentRepository.UpdateWithRelatedEntity(accident, true, new System.Linq.Expressions.Expression<Func<QualityAccident, object>>[] { // u =>u.SettlementTime, // u=>u.DisposalState //}); }
public IActionResult SettleAccident(int id, [FromBody] SettleQualityAccidentInput input) { input.Id = id; _problemService.SettleAccident(input); return(Created("", new { id })); }