コード例 #1
0
ファイル: DataAccess.cs プロジェクト: sjbamber/MattBaines
 // Write
 public bool AddAdvertisingCreativeCategory(AdvertisingCreativeCategory category)
 {
     try
     {
         _db.AdvertisingCreativeCategories.Add(category);
         _db.SaveChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
ファイル: DataAccess.cs プロジェクト: sjbamber/MattBaines
 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;
     }
 }
コード例 #5
0
 public ActionResult Create()
 {
     AdvertisingCreativeCategory accategory = new AdvertisingCreativeCategory();
     return View("Create", accategory);
 }