public async Task DeleteLeave(Guid id) { var leave = await _leaveRepository.GetById(id); var soldier = await _soldierRepository.GetById((Guid)leave.SoldierId); soldier.Status = "X"; await _soldierRepository.UpdateSoldier(soldier); await _leaveRepository.DeleteLeave(id); }
public async Task <IActionResult> DeleteLeave(int id) { try { ReturnResult result = await _leaveRepository.DeleteLeave(id); return(Ok(result)); } catch (Exception x) { return(StatusCode(StatusCodes.Status500InternalServerError)); } }