Exemplo n.º 1
0
        public async Task <IActionResult> ProductType([FromForm] ProductTypeViewModel model)
        {
            string attachPath = string.Empty;

            if (model.formFile != null)
            {
                string fileName;
                string message = FileSave.SaveImage(out fileName, "Upload/Attachment/ProductType", model.formFile);

                if (message == "success")
                {
                    attachPath = fileName;
                }
            }
            ProductType productType = new ProductType
            {
                Id = (int)model.productTypeId,
                productTypeName   = model.productTypeName,
                productTypeNameBn = model.productTypeNameBn,
                imagePath         = attachPath
            };
            await lostAndFoundType.SaveProductType(productType);

            return(RedirectToAction(nameof(ProductType)));
        }