public async Task <IActionResult> CreateActionPlan([FromBody] CreateActionPlanDto act, CancellationToken ct) { _logger.LogInformation("called CreateActionPlan {0}", act.ToString()); var id = await _actionService.CreateActionPlanAsync(act, ct); if (id == null) { return(UnprocessableEntity()); } else { return(CreatedAtRoute("GetActionPlan", new { id }, act)); } }
public async Task <int?> CreateActionPlanAsync(CreateActionPlanDto CreateActionPlanDto, CancellationToken ct) { ActionPlan ActionPlanEntity = _mapper.Mapper.Map <ActionPlan>(CreateActionPlanDto); _uow.ActionPlan.CreateActionPlan(ActionPlanEntity); if (await _uow.SaveChangesAsync(ct) > 0) { return(ActionPlanEntity.Id);// personsEntity.Id; } else { return(null); } }