public ActionResult Display(int Id) { if (Session["loggedUser"] == null) { return(RedirectToAction("Login", "Home")); } Service1Client service = new Service1Client(); BookDTO item = service.GetBookById(Id); AuthorDTO author = service.GetAuthorById(item.bookAuthor.Id); GenreDTO genre = service.GetGenreById(item.bookGenre.Id); List <UserToBookDTO> items = service.GetUsersByBookId(item.Id).ToList(); DisplayVM book = new DisplayVM() { Id = item.Id, Title = item.Title, Author = author.FirstName + " " + author.LastName, Genre = genre.GenreName, Description = item.Description, DateAdded = item.DateAdded, Price = item.Price, Rating = item.Rating, Users = items }; //ViewData["users"] = Users; return(View(book)); }
public ActionResult Catelog(int id = 1) { DisplayVM vm = new DisplayVM(); vm.Categories = db.Categories.ToList(); vm.Products = db.Products.Where(p => p.CategoryID == id); return(View(vm)); }
static void initClass() { Log.WriteLine("init class"); handler = new SocketHandler(ip, port); parser = new Parser(); dump = new Dump(); disp = new DisplayVM(dump); players = new Players(); cycle = new CycleDisplay(); end = new Display.End(); }
public ActionResult Display(int Id) { Service1Client service = new Service1Client(); service.UpdateGenreBookInfo(service.GetGenreById(Id)); GenreDTO genre = service.GetGenreById(Id); DisplayVM model = new DisplayVM { Id = genre.Id, GenreName = genre.GenreName, Description = genre.Description, Rating = genre.Rating, LastUpdated = genre.LastUpdated, BookCount = genre.BookCount }; return(View(model)); }
public ActionResult Display(int Id) { Service1Client service = new Service1Client(); service.UpdateAuthorBookInfo(service.GetAuthorById(Id)); AuthorDTO author = service.GetAuthorById(Id); DisplayVM model = new DisplayVM { Id = author.Id, FirstName = author.FirstName, LastName = author.LastName, Description = author.Description, Rating = author.Rating, ActiveFrom = author.ActiveFrom, ActiveTo = author.ActiveTo, BookCount = author.BookCount }; return(View(model)); }