/// <summary> /// /// </summary> /// <param name="vHelper"></param> /// <param name="vData"></param> /// <returns></returns> public static MvcHtmlString CreateMenu(this HtmlHelper vHelper) { var tmpSb = new StringBuilder(); var db = new ContentDataContext(Comun.GetConnString()); var tmpData = db.Categories.ToList().OrderBy(c => c.OrderBy); cRenderMenu(vHelper, tmpData, ref tmpSb); return(MvcHtmlString.Create(tmpSb.ToString())); }
static void Main(string[] args) { using (var ctx = new ContentDataContext()) { foreach (var episode in ctx.Episodes) { Console.WriteLine(episode.Title); } } }
public FileContentResult GetPhoto(int id) { var db = new ContentDataContext(Comun.GetConnString()); var tmpPhoto = db.Photos.Where(c => c.IDPhoto == id).FirstOrDefault(); if (tmpPhoto != null && tmpPhoto.PhotoLarge != null && tmpPhoto.PhotoLarge.Length > 0) { return(File(tmpPhoto.PhotoLarge.ToArray(), tmpPhoto.ContentType)); } else { return(null); } }
public ActionResult SlideContainer(int vContentId) { var db = new ContentDataContext(Comun.GetConnString()); var tmpPhoto = db.ContentPhotos.Where(c => c.IDContent == vContentId) .Where(c => c.IsDeleted == false) .Select(c => new CPhoto { IDPhoto = c.IDPhoto, Description = c.Photo.Description }) .ToList(); return(PartialView("_SlideContainer", tmpPhoto)); }
public ActionResult Index() { ViewBag.Message = "Welcome to ASP.NET MVC!"; var db = new ContentDataContext(Comun.GetConnString()); var tmpData = db.Categories .Where(c => c.IsMenu == true && c.IDParent == -1) .OrderBy(c => c.OrderBy).FirstOrDefault(); if (tmpData != null) { return(RedirectToAction("Index", "GeneralPage", new { id = tmpData.IDCategory })); } else { return(View()); } }
// // GET: /GeneralPage/ public ActionResult Index(int id) { var tmpSb = new StringBuilder(); var db = new ContentDataContext(Comun.GetConnString()); var tmpCategory = db.Categories.Where(c => c.IDCategory == id).FirstOrDefault(); var tmpContent = db.Content_Categories .Where(c => c.IDCategory == id) .Select(c => c.Content) .FirstOrDefault(); ViewBag.PhotoId = tmpCategory != null ? tmpCategory.IDPhoto : 0; ViewBag.Slide = tmpContent != null && tmpContent.ContentPhotos != null && tmpContent.ContentPhotos.Any() ? true : false; var tmpCategoryTypeEnum = (DataSenalesCaribe.Comun.Enums.CategoryType)tmpCategory.pCategoryType; ViewBag.CategoryType = tmpCategoryTypeEnum; return(View(tmpContent)); }