public async Task <IActionResult> DeleteCity(int id)
        {
            var city = services.Find(id);

            if (city == null)
            {
                return(NotFound());
            }

            await services.Delete(id);

            return(NoContent());
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 4
0
 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
         }));
     }
 }
Ejemplo n.º 5
0
        public IResponseDTO Delete(int id)
        {
            var result = ServicesCity.Delete(id);

            return(result);
        }
Ejemplo n.º 6
0
 public async Task Delete(int id)
 {
     await _service.Delete(id);
 }