コード例 #1
0
 public async Task <IActionResult> DeleteZone([FromRoute] Zone zone)
 {
     try
     {
         return(Ok(await _context.DeleteZoneAsync(zone)));
     }
     catch (ArgumentException e)
     {
         return(BadRequest(new { error = e.Message }));
     }
 }
コード例 #2
0
        public async Task <StatusCodeResult> Delete(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(BadRequest());
            }

            var result = await _zoneService.DeleteZoneAsync(id);

            if (!result)
            {
                return(NotFound());
            }
            return(Ok());
        }