示例#1
0
        public NgPageWriteup GetWriteUps()
        {
            NgPageWriteup writeup = context.NgPageWriteups.Where(c => c.Id == 2).FirstOrDefault();

            if (writeup != null)
            {
                return(writeup);
            }
            return(null);
        }
示例#2
0
        public ActionResult EditNgPageWriteups()
        {
            NgPageWriteup writeup = _productRepository.GetWriteUps();

            if (writeup != null)
            {
                return(PartialView("~/Views/Admin/_editPageWriteup.cshtml", writeup));
            }
            return(PartialView("~/Views/Admin/_editPageWriteup.cshtml", new NgPageWriteup()));
        }
示例#3
0
 public ActionResult EditNgPageWriteups(NgPageWriteup ngPageWriteup)
 {
     if (ModelState.IsValid)
     {
         _productRepository.SaveWriteUps(ngPageWriteup);
         TempData["successMessage"] = string.Format("Page writeup has been saved");
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(ngPageWriteup));
     }
 }
示例#4
0
 public void SaveWriteUps(NgPageWriteup writeup)
 {
     if (writeup.Id == 0)
     {
         context.NgPageWriteups.Add(writeup);
     }
     else
     {
         NgPageWriteup dbEntry = context.NgPageWriteups.Find(writeup.Id);
         if (dbEntry != null)
         {
             dbEntry.ExclusiveProductText = writeup.ExclusiveProductText;
             dbEntry.FashionTrendsText    = writeup.FashionTrendsText;
             dbEntry.TopNgCollectionText  = writeup.TopNgCollectionText;
         }
     }
     context.SaveChanges();
 }