public static BaseIncident ToAutoMapper(this IncidentUpdateModel @this)
 {
     return(new BaseIncident(
                id: @this.Id,
                incidentTitle: @this.IncidentTitle,
                incidentTypeId: @this.IncidentTypeId,
                incidentSourceId: @this.IncidentSourceId,
                contactMethodId: @this.ContactMethodId,
                statusId: @this.StatusId,
                signalStatusId: @this.SignalStatusId,
                notifierId: @this.NotifierId == 0 ? new Nullable <int>() : @this.NotifierId,
                priorityId: @this.PriorityId,
                principalFBOId: @this.PrincipalFBOId == 0 ? new Nullable <int>() : @this.PrincipalFBOId,
                classificationId: @this.ClassificationId,
                dataSourceId: @this.DataSourceId,
                signalUrl: @this.SignalUrl,
                productTypeId: @this.ProductTypeId,
                leadOfficer: @this.LeadOfficer,
                leadOffice: @this.LeadOffice,
                adminLeadId: @this.AdminLeadId == 0 ? new Nullable <int>() : @this.AdminLeadId,
                oimtGroups: @this.OIMTGroups ?? "",
                fieldOfficer: @this.FieldOfficer,
                onlineFormId: @this.OnlineFormId,
                leadLocalAuthorityId: @this.LeadLocalAuthorityId == 0 ? new Nullable <int>() : @this.LeadLocalAuthorityId,
                lAAdvised: @this.LAAdvised,
                deathIllnessId: @this.DeathIllnessId == 0 ? null : @this.DeathIllnessId,
                mostUniqueId: Guid.Empty,
                sensitiveInfo: @this.SensitiveInfo,
                incidentClosed: null,
                lastChangedBy: null,
                lastChangedDate: DateTime.Now,
                receivedOn: @this.ReceivedOn,
                incidentCreated: DateTime.Now
                ));
 }
Exemple #2
0
 internal static IncidentUpdateEntity ToEntity(this IncidentUpdateModel model, int?userId) => new IncidentUpdateEntity
 {
     AuthorId   = model.AuthorId,
     AssigneeId = model.AssigneeId > 0 ? model.AssigneeId : (int?)null,
     Status     = model.Status,
     ChangedBy  = userId,
     Comment    = !string.IsNullOrWhiteSpace(model.Comment) ? model.Comment : null
 };
 public IncidentUpdate(IncidentUpdateModel model)
 {
     Id         = model.Id;
     Message    = model.Message;
     CreatedAt  = model.CreatedAt;
     State      = model.State;
     IncidentId = model.IncidentId;
 }
        public IncidentUpdate UpdateIncidentUpdate(IncidentUpdate incidentUpdate)
        {
            var model = new IncidentUpdateModel(incidentUpdate);

            using var ctx = CreateContext();
            ctx.IncidentUpdates.Update(model);
            ctx.SaveChanges();

            return(new IncidentUpdate(model));
        }
        public async Task <IActionResult> UpdateIncident([FromBody, SwaggerParameter("Updated Incident", Required = true)] IncidentUpdateModel incident)
        {
            var mappedIncindet = mapper.Map <IncidentUpdateModel, BaseIncident>(incident);

            return(new OkObjectResult(await this.simsApp.Incidents.Update(mappedIncindet)));
        }
 public async Task <ActionResult> UpdateIncident(long id, [FromBody] IncidentUpdateModel model) => await Execute(async operation =>
 {
     var entity = model.ToEntity(UserId);
     entity.IncidentOperationId = id;
     await operationWithLogsService.UpdateIncident(operation, entity);
 });