public ActionResult Manage([Bind(Include = "UniqueId,ColorId,ColorName,ColorCode")] tbl_Color model) { if (ModelState.IsValid) { try { if (model.Color_Id == 0) { int response = cem.ManageColor(model, "Insert"); if (response > 0) { TempData["SuccessMsg"] = "Color Added Successfully"; } } else { int response = cem.ManageColor(model, "Update"); if (response > 0) { TempData["SuccessMsg"] = "Category Update Successfully"; } } //db.Entry(category.State = System.Data.Entity.EntityState.Modified; //db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } } return(View()); }
public ActionResult Edit([Bind(Include = "id,name")] tbl_Color tbl_color) { if (ModelState.IsValid) { db.Entry(tbl_color).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_color)); }
public ActionResult Create([Bind(Include = "ColorId,ColorName,IsActive,IsDelete,DateAdded,DateUpdated")] tbl_Color model) { if (ModelState.IsValid) { db.tbl_Color.Add(model); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Create([Bind(Include = "id,name")] tbl_Color tbl_color) { if (ModelState.IsValid) { db.tbl_Color.Add(tbl_color); db.SaveChanges(); ViewBag.message = "Color Inserted Succesfully"; return(View(tbl_color)); } return(View(tbl_color)); }
// GET: /Color/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_Color tbl_color = db.tbl_Color.Find(id); if (tbl_color == null) { return(HttpNotFound()); } return(View(tbl_color)); }
public JsonResult DeleteConfirmed(int id) { string success = string.Empty; // return Json(success, JsonRequestBehavior.AllowGet); tbl_Color tbl_color = db.tbl_Color.Find(id); db.tbl_Color.Remove(tbl_color); int result = db.SaveChanges(); if (result > 0) { success = "Data delete successfully"; } // return Json(success, JsonRequestBehavior.AllowGet); return(Json(new { result = success })); }
public ActionResult Manage(Guid Id) { tbl_Color model = new tbl_Color(); if (Id == null) { return(HttpNotFound()); } ViewBag.PageType = "Add"; if (Id != null && Id != Guid.Parse("00000000-0000-0000-0000-000000000000")) { ViewBag.PageType = "Edit"; model = cem.ColorSelectColorById(Id); return(View(model)); } else if (Id == Guid.Parse("00000000-0000-0000-0000-000000000000") && Id != null) { return(View(model)); } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }