Esempio n. 1
0
 //
 // GET: /Title/
 public ActionResult Index(Title title)
 {
     using (TitlesEntities dbContext = new TitlesEntities())
     {
         Title model = dbContext.Titles.Where(t => t.TitleId == title.TitleId).FirstOrDefault();
         return View(model);
     }
 }
Esempio n. 2
0
        public ActionResult Index()
        {
            ViewBag.Message = "Library";

            using (TitlesEntities dbContext = new TitlesEntities())
            {
                IList<Title> model = dbContext.Titles.ToList();

                return View(model);
            }
        }
Esempio n. 3
0
        public ActionResult Index()
        {
            ViewBag.Message = "Library";

            using (TitlesEntities dbContext = new TitlesEntities())
            {
                IList<Title> model = dbContext.Titles.ToList();

                ViewBag.Titles = model;
                ViewBag.Titles = new SelectList(model.OrderByDescending(m=> m.ReleaseYear).ThenBy(m=>m.TitleName), "TitleId", "TitleName");

                return View();
            }
        }
Esempio n. 4
0
        public List <TitleResultModel> GetAllTitles(string title)
        {
            var repo    = new TitlesEntities();
            var results = _titlesRepo.Titles.Where(x => x.TitleName.Contains(title)).ToList();

            List <TitleResultModel> trmList = new List <TitleResultModel>();

            foreach (var result in results)
            {
                TitleResultModel trm = new TitleResultModel();
                trm.TitleID     = result.TitleId;
                trm.TitleName   = result.TitleName;
                trm.ReleaseYear = result.ReleaseYear.ToString();
                trmList.Add(trm);
            }

            return(trmList);
        }
Esempio n. 5
0
        public TitleDetailsModel GetTitleDetails(string id)
        {
            var titleID = Convert.ToInt32(id);
            var repo    = new TitlesEntities();
            var titles  = _titlesRepo.Titles.Where(x => x.TitleId == titleID).FirstOrDefault();

            var awards      = titles.Awards.Where(x => x.AwardWon == true).OrderByDescending(x => x.AwardYear).ToList();
            var nominations = titles.Awards.Where(x => x.AwardWon == false).OrderByDescending(x => x.AwardYear).ToList();

            var awardsList = new List <AwardModel>();

            foreach (var award in awards)
            {
                AwardModel am = new AwardModel();
                am.Award        = award.Award1;
                am.AwardCompany = award.AwardCompany;
                am.AwardYear    = award.AwardYear.ToString();
                awardsList.Add(am);
            }

            var nominationsList = new List <AwardModel>();

            foreach (var nomination in nominations)
            {
                AwardModel am = new AwardModel();
                am.Award        = nomination.Award1;
                am.AwardCompany = nomination.AwardCompany;
                am.AwardYear    = nomination.AwardYear.ToString();
                nominationsList.Add(am);
            }

            TitleDetailsModel tdm = new TitleDetailsModel();

            tdm.ReleaseYear  = titles.ReleaseYear.ToString();
            tdm.TitleName    = titles.TitleName;
            tdm.Genres       = titles.TitleGenres.Select(x => x.Genre.Name).ToList();
            tdm.Description  = titles.StoryLines.FirstOrDefault().Description;
            tdm.Participants = titles.TitleParticipants.Select(x => x.Participant.Name).ToList();
            tdm.Awards       = awardsList;
            tdm.Nominations  = nominationsList;

            return(tdm);
        }
Esempio n. 6
0
 public TitleAgent()
 {
     map            = new Mappers.Mappers();
     titlesEntities = new TitlesEntities();
 }
Esempio n. 7
0
 public TitlesController()
 {
     _titlesRepo = new TitlesEntities();
 }