Example #1
0
        public void SettleAccident(SettleSafetyAccidentInput input)
        {
            var existing = _accidentRepository.Get().Include(u => u.SettlementPhotoSets).Where(u => u.Id == input.Id).FirstOrDefault();
            var accident = input.MapTo <SafetyAccident>();

            accident.DisposalState = DisposalState.Completed;
            _accidentRepository.Update(accident, existing, new System.Linq.Expressions.Expression <Func <SafetyAccident, 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
            }));
            //_accidentRepository.UpdateWithRelatedEntity(accident,true,
            //    new System.Linq.Expressions.Expression<Func<SafetyAccident, object>>[] {
            //    u =>u.SettlementTime,
            //    u=>u.DisposalState
            //});
        }
Example #2
0
 public IActionResult SettleAccident(int id, [FromBody] SettleSafetyAccidentInput input)
 {
     input.Id = id;
     _problemService.SettleAccident(input);
     return(Created("", new { id }));
 }