예제 #1
0
 public ActionResult About()
 {
     tContent contentData = _contentRepository.FindByCode("about");
     if (contentData == null) {
         contentData = new tContent { Name = "Not Found", Description = "Not Found" };
     }
     return View(contentData);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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;
         }
     }
 }
예제 #4
0
 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"
         });
     }
 }
예제 #5
0
 partial void DeletetContent(tContent instance);
예제 #6
0
 partial void UpdatetContent(tContent instance);
예제 #7
0
 partial void InserttContent(tContent instance);
예제 #8
0
		private void detach_tContents(tContent entity)
		{
			this.SendPropertyChanging();
			entity.tCategory = null;
		}
예제 #9
0
		private void attach_tContents(tContent entity)
		{
			this.SendPropertyChanging();
			entity.tCategory = this;
		}
예제 #10
0
 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);
 }