public NgPageWriteup GetWriteUps() { NgPageWriteup writeup = context.NgPageWriteups.Where(c => c.Id == 2).FirstOrDefault(); if (writeup != null) { return(writeup); } return(null); }
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())); }
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)); } }
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(); }