public async Task <IActionResult> DeleteById(Guid id) { var phone = await _phoneService.GetPhoneById(id); if (phone != null) { await _phoneService.DeletePhone(id); return(Ok()); } else { return(NotFound()); } }
public JsonResult DeletePhone(int id) { try { _phoneService.DeletePhone(id); return(Json(new { Result = "OK" })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public async Task <ActionResult <Phone> > Delete(int id) { Phone phone = await phoneService.GetPhone(id); if (phone == null) { return(BadRequest()); } await phoneService.DeletePhone(id); return(Ok(phone)); }
public IHttpActionResult DeletePhone(int id) { Phone phone = service.GetPhone(id); if (phone == null) { return(NotFound()); } service.DeletePhone(phone); return(Ok(phone)); }