protected virtual async Task Update(CreateOrEditIncidentDto input) { var incident = await _incidentRepository.FirstOrDefaultAsync((int)input.Id); ObjectMapper.Map(input, incident); CreateLocation(input.Location); }
public async Task CreateOrEdit(CreateOrEditIncidentDto input) { if (input.Id == null) { await Create(input); } else { await Update(input); } }
/// <summary> /// The Create /// </summary> /// <param name="input">The input<see cref="CreateOrEditIncidentDto" /></param> /// <returns>The <see cref="Task" /></returns> private async Task Create(CreateOrEditIncidentDto input) { var incident = ObjectMapper.Map <Incident>(input); if (AbpSession.TenantId != null) { incident.TenantId = AbpSession.TenantId; } await _incidentRepository.InsertAsync(incident); }
protected virtual async Task Create(CreateOrEditIncidentDto input) { //TODO: Check if sensitive related data is legal (i.e. CustomerId, AssetId, SupportItemId, UserId) var incident = ObjectMapper.Map <Incident>(input); if (AbpSession.TenantId != null) { incident.TenantId = (int?)AbpSession.TenantId; } var tenantInfo = await TenantManager.GetTenantInfo(); if (tenantInfo.Tenant.TenantType == "C") { incident.CustomerId = tenantInfo.Customer.Id; } await _incidentRepository.InsertAsync(incident); CreateLocation(input.Location); }