private LeaveSoldierDto Map(Leave leave) { var soldier = _context.Soldiers.SingleOrDefault(x => x.Id == leave.SoldierId); var leaveSoldierDto = new LeaveSoldierDto { SoldierName = $"{soldier.Name} {soldier.Surname}", DateLeave = leave.DateLeave, DateReturn = leave.DateReturn, Where = leave.Where, Typ = leave.Typ, Annotation = leave.Annotation, Id = leave.Id }; return(leaveSoldierDto); }
public async Task <IActionResult> leaves(LeaveSoldierDto leaveSoldierDto) { var leaveToCreate = new Leave { Id = leaveSoldierDto.Id, DateLeave = leaveSoldierDto.DateLeave, DateReturn = leaveSoldierDto.DateReturn, SoldierId = leaveSoldierDto.SoldierId, Where = leaveSoldierDto.Where, Typ = leaveSoldierDto.Typ, Annotation = leaveSoldierDto.Annotation }; await _repo.Leave(leaveToCreate); return(StatusCode(201)); }