public async Task<string> ExtractViewTextAsync(OracleObjectIdentifier viewIdentifier, CancellationToken cancellationToken) { var dataModel = new ViewDetailModel(); var viewDetailsDataProvider = new ViewDetailDataProvider(dataModel, viewIdentifier, _databaseModel.Version); await UpdateDataModel(cancellationToken, viewDetailsDataProvider); return dataModel.Text; }
// GET: Detail public IActionResult Index() { var view = new ViewDetailModel(); var gImage = _context.ProductImages.FirstOrDefault(i => i.Index == 1)?.Path ?? ""; return(View(view)); }
public async Task <string> ExtractViewTextAsync(OracleObjectIdentifier viewIdentifier, CancellationToken cancellationToken) { var dataModel = new ViewDetailModel(); var viewDetailsDataProvider = new ViewDetailDataProvider(dataModel, viewIdentifier, _databaseModel.Version); await UpdateDataModel(cancellationToken, viewDetailsDataProvider); return(dataModel.Text); }
// GET: Detail/Edit/5 public IActionResult Edit(string id) { var view = new ViewDetailModel(); var product = _context.Products.FirstOrDefault(n => n.Id == id); if (product != null) { var productType = _context.ProductTypes.FirstOrDefault(n => n.Id == product.ProductTypeId)?.Name ?? ""; var productSubType = _context.ProductSubTypes.FirstOrDefault(n => n.Id == product.ProductSubTypeId)?.Name ?? ""; view.Product = new ProductModel() { Id = product.Id, Name = product.Name, Code = product.Code, Origin = product.Origin, Color = product.Color, Stuff = product.Stuff, Size = product.Size, Price = product.Price, Price2 = product.Price2, IsBestSelling = product.IsBestSelling, Description = product.Description, ProductTypeId = product.ProductTypeId, ProductTypeName = productType, ProductSubTypeId = product.ProductSubTypeId, ProductSubTypeName = productSubType }; view.ProductImage = _context.ProductImages.Where(n => n.ProductId == id) .Select(n => new ProductImageModel { Id = n.Id, ImageName = n.ImageName, Extension = n.Extension, Path = n.Path, ProductId = n.ProductId, Index = n.Index, //Base64 = ConvertImageToBase64(n.Path) }).OrderBy(o => o.Index).ToList(); } return(View(view)); }
//public async Task<IActionResult> Index() //{ // return View(await _context.Products.ToListAsync()); //} // GET: Detail/Details/5 public IActionResult Details(string id) { var view = new ViewDetailModel(); // Product Information var product = _context.Products.FirstOrDefault(n => n.Id == id); var productType = _context.ProductTypes.FirstOrDefault(n => n.Id == product.ProductTypeId); var productSubType = _context.ProductSubTypes.FirstOrDefault(n => n.Id == product.ProductSubTypeId); view.Product = new ProductModel() { Name = product.Name, Code = product.Code, Origin = product.Origin, Color = product.Color, Stuff = product.Stuff, Size = product.Size, Description = product.Description, Price = product.Price, Price2 = product.Price2, ProductTypeName = productType?.Name ?? "", ProductSubTypeName = productSubType?.Name ?? "" }; //if (view.Product != null) //{ // view.Product.View++; // _context.SaveChanges(); //} // General Image view.GImage = _context.ProductImages.FirstOrDefault(i => i.ProductId == id && i.Index == 1); if (view.GImage == null) { view.GImage = new ProductImage(); view.GImage.Path = "~/ProductImages/700x700.png"; } else { view.GImage.Path = view.GImage.Path; } // Thumblist Image view.TImage = _context.ProductImages.Where(n => n.ProductId == id).OrderBy(o => o.Index).ToList(); if (view.TImage.Count == 0) { view.TImage.Add(new ProductImage() { Path = "~/ProductImages/700x700.png" }); view.TImage.Add(new ProductImage() { Path = "~/ProductImages/700x700.png" }); view.TImage.Add(new ProductImage() { Path = "~/ProductImages/700x700.png" }); view.TImage.Add(new ProductImage() { Path = "~/ProductImages/700x700.png" }); } else { view.TImage = view.TImage.Select(c => { c.Path = c.Path; return(c); }).ToList(); } return(View(view)); }