Example #1
0
 // Write
 public bool AddAdvertisingCreativeCategory(AdvertisingCreativeCategory category)
 {
     try
     {
         _db.AdvertisingCreativeCategories.Add(category);
         _db.SaveChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
 public ActionResult Create(AdvertisingCreativeCategory accategory)
 {
     if (ModelState.IsValid)
     {
         if (_db.AddAdvertisingCreativeCategory(accategory)) {
             TempData["Notice"] = "Category Created Successfully";
             return RedirectToAction("Index");
         }
         else
         {
             TempData["Notice"] = "Category Creation Failed";
         }
     }
     return View(accategory);
 }
 public ActionResult Edit(AdvertisingCreativeCategory accategory)
 {
     if (ModelState.IsValid)
     {
         accategory.UpdatedDate = DateTime.Now;
         if (_db.UpdateAdvertisingCreativeCategory(accategory))
         {
             TempData["Notice"] = "Category Updated Successfully";
             return RedirectToAction("Index");
         }
         else
         {
             TempData["Notice"] = "Category Update Failed";
         }
     }
     return View(accategory);
 }
Example #4
0
 public bool UpdateAdvertisingCreativeCategory(AdvertisingCreativeCategory ACcategory)
 {
     try
     {
         AdvertisingCreativeCategory ACcategoryToUpdate = _db.AdvertisingCreativeCategories.Find(ACcategory.Id);
         _db.Entry(ACcategoryToUpdate).CurrentValues.SetValues(ACcategory);
         _db.SaveChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
 public ActionResult Create()
 {
     AdvertisingCreativeCategory accategory = new AdvertisingCreativeCategory();
     return View("Create", accategory);
 }