public static BaseIncident ToAutoMapper(this IncidentCreateModel @this) => new BaseIncident( id: @this.Id, mostUniqueId: Guid.Empty, incidentTitle: @this.IncidentTitle, incidentSourceId: @this.IncidentSourceId, incidentTypeId: @this.IncidentTypeId, contactMethodId: @this.ContactMethodId, statusId: @this.StatusId, signalStatusId: @this.SignalStatusId, notifierId: @this.NotifierId.HasValue && @this.NotifierId != 0 ? @this.NotifierId : null, // 0 used as an ordinal due to powerapp limitiaion priorityId: @this.PriorityId, principalFBOId: @this.PrincipalFBOId.HasValue && @this.PrincipalFBOId != 0 ? @this.PrincipalFBOId : null, // 0 used as an ordinal due to powerapp limitiaion classificationId: @this.ClassificationId, dataSourceId: @this.DataSourceId, signalUrl: @this.SignalUrl, productTypeId: @this.ProductTypeId, leadOfficer: @this.LeadOfficer, leadOffice: @this.LeadOffice, adminLeadId: @this.AdminLeadId.HasValue && @this.AdminLeadId.Value != 0 ? @this.AdminLeadId : null, // 0 used as an ordinal due to powerapp limitiaion oimtGroups: @this.OIMTGroups ?? "", fieldOfficer: @this.FieldOfficer, leadLocalAuthorityId: @this.LeadLocalAuthorityId.HasValue && @this.LeadLocalAuthorityId.Value != 0 ? @this.LeadLocalAuthorityId : null, // 0 used as an ordinal due to powerapp limitiaion lAAdvised: @this.LAAdvised, deathIllnessId: @this.DeathIllnessId == 0? null : @this.DeathIllnessId, receivedOn: @this.ReceivedOn, onlineFormId: null, sensitiveInfo: @this.SensitiveInfo, incidentCreated: @this.IncidentCreated, incidentClosed: null, lastChangedBy: null, lastChangedDate: DateTime.Now );
public async Task <IActionResult> CreateIncident([FromBody, SwaggerParameter("Create Incident", Required = true)] IncidentCreateModel incident) { return(new OkObjectResult(await this.simsApp.Incidents.Add(mapper.Map <BaseIncident>(incident)))); }