public ActionResult CategoryEdit(tbl_product_category model) { var category = db.tbl_product_category.Where(x => x.Code == model.Code).FirstOrDefault(); category.Name = model.Name; db.SaveChanges(); return(RedirectToAction("CategoryList")); }
public ActionResult CreateCategory(tbl_product_category model) { // var item = db.tbl_product_category.Max(Convert.ToInt32(y=>y.Code)); // var itemsMax = items.Where(x => x.Height == items.Max(y => y.Height)); // int lastCode=db.tbl_product_category. //int item = 13; // tbl_product_category tbl = new tbl_product_category(); // tbl.Code = (int)(item); // tbl.Name = model.Name; // db.tbl_product_category.Add(tbl); return(RedirectToAction("CategoryList")); }