public IHttpActionResult PutGianella(int id, Gianella gianella) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != gianella.gianellaID) { return(BadRequest()); } db.Entry(gianella).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GianellaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { Gianella gianella = db.Gianellas.Find(id); db.Gianellas.Remove(gianella); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "gianellaID,Friendofgianella,Place,Email,Birthdate")] Gianella gianella) { if (ModelState.IsValid) { db.Entry(gianella).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gianella)); }
public IHttpActionResult GetGianella(int id) { Gianella gianella = db.Gianellas.Find(id); if (gianella == null) { return(NotFound()); } return(Ok(gianella)); }
public ActionResult Create([Bind(Include = "gianellaID,Friendofgianella,Place,Email,Birthdate")] Gianella gianella) { if (ModelState.IsValid) { db.Gianellas.Add(gianella); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gianella)); }
public IHttpActionResult PostGianella(Gianella gianella) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Gianellas.Add(gianella); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = gianella.gianellaID }, gianella)); }
public IHttpActionResult DeleteGianella(int id) { Gianella gianella = db.Gianellas.Find(id); if (gianella == null) { return(NotFound()); } db.Gianellas.Remove(gianella); db.SaveChanges(); return(Ok(gianella)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Gianella gianella = db.Gianellas.Find(id); if (gianella == null) { return(HttpNotFound()); } return(View(gianella)); }