public async Task <IActionResult> DeleteCity(int id) { var city = services.Find(id); if (city == null) { return(NotFound()); } await services.Delete(id); return(NoContent()); }
public IActionResult Delete(int id) { var cityFromRepo = _services.GetByID(id); if (cityFromRepo == null) { return(BadRequest("Not a value city id")); } _services.Delete(cityFromRepo); _services.SaveChange(); return(Ok()); }
public async Task <ActionResult> Delete(long id) { #region Start the watch var watch = new Stopwatch(); watch.Start(); #endregion var result = await _entityServices.Delete(id); #region End the watch watch.Stop(); result.Meta.TotalProcessingTime = watch.ElapsedMilliseconds; #endregion return(Ok(result)); }
public async Task <ActionResult> Delete([FromQuery] IdRequest request) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(await _cityService.Delete(request.Id))); } catch (Exception ex) { return(BadRequest(new Response { IsSuccess = true, Message = ex.Message })); } }
public IResponseDTO Delete(int id) { var result = ServicesCity.Delete(id); return(result); }
public async Task Delete(int id) { await _service.Delete(id); }