public IHttpActionResult PutPhone(int id, Phone phone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != phone.Id) { return(BadRequest()); } db.Entry(phone).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PhoneExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,LastName,FirstName,MiddleName,DateOfBirth,Number")] Phone phone) { if (ModelState.IsValid) { db.Entry(phone).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Browse")); } return(View(phone)); }
public ActionResult Edit([Bind(Include = "CateID,CateName")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "PhoneID,PhoneName,PhonePrice,PhoneDescription,PublisherDate,Image,CateID")] Phone phone) { if (ModelState.IsValid) { db.Entry(phone).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CateID = new SelectList(db.Category, "CateID", "CateName", phone.CateID); return(View(phone)); }