public IActionResult Details(int?id) { if (this.bagService.BagExists(id)) { BagFullDetailsModel bagFullDetailsModel = this.bagService.GetBagFullDetails(id); return(View(bagFullDetailsModel)); } return(BadRequest()); }
public BagFullDetailsModel GetBagFullDetails(int?id) { var bag = this.db.Bags.First(c => c.Id == id.Value); this.db.Entry(bag).Reference(c => c.User).Load(); var fullDetailsModel = new BagFullDetailsModel() { ImageUrl = bag.ImageUrl, Price = bag.Price, Color = bag.Color, Description = bag.Description, Quantity = bag.Quantity, Title = bag.Title, }; return(fullDetailsModel); }