示例#1
0
        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());
            }
        }
示例#2
0
 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 }));
     }
 }
示例#3
0
        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));
        }
示例#4
0
        public IHttpActionResult DeletePhone(int id)
        {
            Phone phone = service.GetPhone(id);

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

            service.DeletePhone(phone);

            return(Ok(phone));
        }