public ActionResult Save(staticpage obj) { bool check = true; if (Request.IsAuthenticated) { if (obj.id > 0) { check = StaticPagesDal.Update(obj); } else { check = StaticPagesDal.Create(obj); } if (check) { TempData["message"] = "Saved successfully"; } else { TempData["message"] = "Error while saving data"; } return RedirectToAction("Create", "AdminStaticpage", new {id=0 }); } else { return RedirectToAction("index", "home"); } }
public ActionResult Create(int id) { var obj = new staticpage(); if (id > 0) { obj = StaticPagesDal.GetById(id); } return View(obj); }
public static staticpage GetByHeading(String Heading) { var context = new Ecommerce.DbEntity.ecommerceEntities(); var obj = context.staticpages.Where(m => m.Heading == Heading).FirstOrDefault(); var sp = new staticpage(); sp.Content = obj.Content; sp.Groupby = obj.Groupby; sp.Heading = obj.Heading; sp.id = obj.id; return sp; }
public static bool Create(staticpage obj) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); context.staticpages.Add(new DbEntity.staticpage { Content=obj.Content, Groupby=obj.Groupby, Heading=obj.Heading, }); context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }
public static bool Update(staticpage obj) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); var sp = context.staticpages.Where(m => m.id == obj.id).FirstOrDefault(); sp.Content = obj.Content; sp.Groupby = obj.Groupby; sp.Heading = obj.Heading; context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }