public ActionResult Create([Bind(Exclude = "Id")] AcadList alist) { if (daoacadlist.AddAcadList(alist)) { return(RedirectToAction("Index", "DAOPattern")); } else { return(View("Create")); } }
public ActionResult Edit(int id, AcadList al) { if ((id > 0) && (al != null) && (ModelState.IsValid)) { daoacadlist.UpdateAcadList(al); return(RedirectToAction("ProffIndex", "DAOPattern")); } else { return(View("Edit")); } }
public bool AddAcadList(AcadList aclist) { try { entities.AcadList.Add(aclist); entities.SaveChanges(); } catch { return(false); } return(true); }
public bool UpdateAcadList(AcadList aclist) { try { var Entity = entities.AcadList.FirstOrDefault(x => x.Id == aclist.Id); Entity.Counter = aclist.Counter; entities.SaveChanges(); } catch { return(false); } return(true); }