public ActionResult AddProduct(string productCode, string uom = "") { var product = new NetStock.Contract.Product(); if (productCode != null && productCode.Length > 0) { if (productCode == "NEW") { product = new NetStock.Contract.Product(); product.Status = true; } else { product = new NetStock.BusinessFactory.ProductBO().GetProduct(new Contract.Product { ProductCode = productCode, UOM = uom }); product.Photo = new NetStock.BusinessFactory.ProductImageBO().GetProductImage(product.ProductCode); } } product.UOMList = Utility.GetLookupItemList("UOM"); // product.ProductCategoryList = Utility.GetProductCategory(); var PrductCategoryList = new NetStock.BusinessFactory.LookupBO().GetList().Where(x => x.Category == "PRODUCTCATEGORY" && x.Status == true).Select(y => new SelectListItem { Value = y.LookupCode, Text = y.Description }); product.ProductCategoryList = PrductCategoryList; product.LocationList = Utility.GetLookupItemList("LOCATION"); return(View("AddProduct", product)); }
public ActionResult EditProduct(string productCode, string barcode, string uom, string size, string color) { var product = new NetStock.Contract.Product(); if (productCode != null && productCode.Length > 0) { if (productCode == "NEW") { product = new NetStock.Contract.Product(); } else { product = new NetStock.BusinessFactory.ProductBO().GetProduct(new Contract.Product { ProductCode = productCode, BarCode = barcode, UOM = uom, Size = size, Color = color }); product.Photo = new NetStock.BusinessFactory.ProductImageBO().GetProductImage(product.ProductCode); } } product.UOMList = Utility.GetLookupItemList("UOM"); product.ProductCategoryList = Utility.GetProductCategory(); product.LocationList = Utility.GetLocationList(); //return PartialView("AddProduct", product); return(PartialView("NewProduct", product)); }
/* * [Route("AddProduct")] * [HttpGet] * public ActionResult AddProduct(string productCode, string barcode = "", string uom = "", string size = "", string color = "") * { * * var product = new NetStock.Contract.Product(); * * * * if (productCode != null && productCode.Length > 0) * { * if (productCode == "NEW") * { * product = new NetStock.Contract.Product(); * product.Status = true; * } * else * { * product = new NetStock.BusinessFactory.ProductBO().GetProduct(new Contract.Product { ProductCode = productCode, BarCode = barcode, UOM = uom, Size = size, Color = color }); * * product.Photo = new NetStock.BusinessFactory.ProductImageBO().GetProductImage(product.ProductCode); * * //string imageBase64Data = Convert.ToBase64String(product.Photo.ProductImg); * //string imageDataURL = string.Format("data:image/png;base64,{0}", imageBase64Data); * //ViewBag.ImageData = imageDataURL; * * } * } * product.UOMList = Utility.GetLookupItemList("UOM"); * product.ProductCategoryList = Utility.GetProductCategory(); * //product.LocationList = Utility.GetLocationList(); * product.LocationList = Utility.GetLookupItemList("LOCATION"); * * //var t = new FileContentResult(product.Photo.ProductImg, "image/jpeg"); * //ViewBag.Test = t; * //return PartialView("AddProduct", product); * return View("AddProduct", product); * } */ public FileContentResult GetImage(string productCode) { NetStock.Contract.Product product = new NetStock.Contract.Product(); product.Photo = new NetStock.BusinessFactory.ProductImageBO().GetProductImage(productCode); byte[] byteArray = product.Photo.ProductImg; return(byteArray != null ? new FileContentResult(byteArray, "image/jpeg") : null); //return File(product.Photo.ProductImg, "image/jpg"); }