public ActionResult About() { tContent contentData = _contentRepository.FindByCode("about"); if (contentData == null) { contentData = new tContent { Name = "Not Found", Description = "Not Found" }; } return View(contentData); }
public ActionResult ContentDetails(int id) { tContent contentData = _contentRepository.Find(id); if (contentData == null) { contentData = new tContent { Name = "Not Found", Description = "Not Found" }; } ViewBag.OtherContent = _contentRepository.GetListByIDCategory(contentData.IDCategory).Where(t => t.ShowInMenuFlag == true).ToList(); return View(contentData); }
public void InsertOrUpdate(tContent user) { if (user.IDContent == default(int)) { // New entity context.tContents.InsertOnSubmit(user); } else { // Existing entity tContent userToUpdate = Find(user.IDContent); if (userToUpdate != null && userToUpdate.IDContent > 0) { userToUpdate.Name = user.Name; userToUpdate.IDCategory = user.IDCategory; userToUpdate.Code = user.Code; userToUpdate.Description = user.Description; userToUpdate.ShowInMenuFlag = user.ShowInMenuFlag; } } }
public JsonResult Create(tContent contentData) { if (ModelState.IsValid) { contentData.DateAdded = DateTime.Now; _contentRepository.InsertOrUpdate(contentData); _contentRepository.Save(); return Json(new { objectAddedName = contentData.Name, valid = true, Message = "Content was added Succesfully" }); } else { return Json(new { objectAddedName = "", valid = false, Message = "Fill All Fields please" }); } }
partial void DeletetContent(tContent instance);
partial void UpdatetContent(tContent instance);
partial void InserttContent(tContent instance);
private void detach_tContents(tContent entity) { this.SendPropertyChanging(); entity.tCategory = null; }
private void attach_tContents(tContent entity) { this.SendPropertyChanging(); entity.tCategory = this; }
public ActionResult GetContentForMainSitePartial(string Code) { tContent contentData = _contentRepository.FindByCode(Code); if(contentData == null) { contentData = new tContent {Name = "Not Found", Description = "Not Found"}; } return PartialView(contentData); }