public ActionResult DeleteConfirmed(int id) { Glaze glaze = db.Glazes.Find(id); db.Glazes.Remove(glaze); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "GlazeId,GlazeName")] Glaze glaze) { if (ModelState.IsValid) { db.Entry(glaze).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(glaze)); }
public ActionResult Create([Bind(Include = "GlazeId,GlazeName")] Glaze glaze) { if (ModelState.IsValid) { db.Glazes.Add(glaze); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(glaze)); }
// GET: Glazes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Glaze glaze = db.Glazes.Find(id); if (glaze == null) { return(HttpNotFound()); } return(View(glaze)); }
//CREATE method public bool CreateGlaze(GlazeCreate model) { var entity = new Glaze() { OwnerId = _userId, GlazeName = model.GlazeName, Description = model.Description, MinCone = model.MinCone, MaxCone = model.MaxCone, Opacity = model.Opacity, Surface = model.Surface, MainColor = model.MainColor, Atmosphere = model.Atmosphere, FoodSafe = model.FoodSafe, CreatedDate = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.Glaze.Add(entity); return(ctx.SaveChanges() == 1); } }