public IHttpActionResult DeletePhone(int id) { Phone phone = _phoneService.GetOneById(id); if (phone == null) { return(NotFound()); } _phoneService.Delete(id); return(Ok(phone)); }
// GET: Phones/Edit/5 public ActionResult Edit(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Phone phone = _phoneService.GetOneById(id); if (phone == null) { return(HttpNotFound()); } ViewBag.PhoneTypeId = new SelectList(_genericService.GetAll <PhoneType>(), "Id", "Label", phone.PhoneTypeId); return(PartialView("_Edit", phone)); }