public ActionResult EditPurchaseHeader(int id = 0) { TBCUSTOMER obj = dbContext.TBCUSTOMERs.Where(x => x.CustomerId == id).FirstOrDefault(); if (obj == null) { return(HttpNotFound()); } ViewBag.CustomerList = dbContext.TBCUSTOMERs.ToList(); return(View("CustomerIndex", obj)); }
public ActionResult CustomerSaveChanges(TBCUSTOMER obj) { if (obj.CustomerId > 0) { TBCUSTOMER objbrand = dbContext.TBCUSTOMERs.Where(x => x.CustomerId == obj.CustomerId).FirstOrDefault(); objbrand.Name = obj.Name; objbrand.PhoneNo = obj.PhoneNo; } else { dbContext.TBCUSTOMERs.Add(obj); } dbContext.SaveChanges(); return(RedirectToAction("CustomerIndex")); }