public async Task <IActionResult> CreateProgramm([FromBody] CreateProgrammDto Prog, CancellationToken ct) { _logger.LogInformation("called CreateActionPlan {0}", Prog.ToString()); var id = await _ProgrammService.CreateProgrammAsync(Prog, ct); if (id == null) { return(UnprocessableEntity()); } else { return(CreatedAtRoute("GetProgramm", new { id }, Prog)); } }
public async Task <int?> CreateProgrammAsync(CreateProgrammDto CreateProgrammDto, CancellationToken ct) { Programm ProgrammEntity = _mapper.Mapper.Map <Programm>(CreateProgrammDto); _uow.Programm.CreateProgramm(ProgrammEntity); if (await _uow.SaveChangesAsync(ct) > 0) { return(ProgrammEntity.Id);// personsEntity.Id; } else { return(null); } }