Exemple #1
0
 public ActionResult Create([Bind(Exclude = "Id")] AcadList alist)
 {
     if (daoacadlist.AddAcadList(alist))
     {
         return(RedirectToAction("Index", "DAOPattern"));
     }
     else
     {
         return(View("Create"));
     }
 }
Exemple #2
0
 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"));
     }
 }
Exemple #3
0
 public bool AddAcadList(AcadList aclist)
 {
     try
     {
         entities.AcadList.Add(aclist);
         entities.SaveChanges();
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Exemple #4
0
        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);
        }