public void Delete(Guid id) { var airplane = _repository.GetById(id); if (airplane == null) { throw new Exception(ExceptionConstants.AIRPLANE_NOT_FOUND); } _repository.Delete(HydrateAirplaneDto(airplane)); }
public async Task <IActionResult> Delete(int airplaneId) { if (!int.TryParse(User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? string.Empty, out var _)) { return(Unauthorized()); } var privilages = new List <int>() { (int)UserPrivileges.Administrator, (int)UserPrivileges.Employee }; int.TryParse(User.FindFirst(ClaimTypes.Role)?.Value, out var privilagesId); if (!privilages.Contains(privilagesId)) { return(StatusCode((int)HttpStatusCode.Unauthorized)); } var result = await _airplaneRepository.Delete(airplaneId); return(result ? Ok() : StatusCode((int)HttpStatusCode.InternalServerError)); }
public IActionResult Delete(Guid id) { _airplaneRepository.Delete(id); return(Response()); }
public async Task Excluir(int id) { await _repository.Delete(id); await _repository.SaveChanges(); }
public async Task Delete(Guid id) { await _repository.Delete(id); }