Пример #1
0
        public async Task <int> SaveOtherBrand(OtherBrand otherBrand)
        {
            if (otherBrand.Id != 0)
            {
                _context.OtherBrands.Update(otherBrand);

                await _context.SaveChangesAsync();

                return(1);
            }
            else
            {
                await _context.OtherBrands.AddAsync(otherBrand);

                await _context.SaveChangesAsync();

                return(1);
            }
        }
Пример #2
0
        public async Task <IActionResult> OtherBrand([FromForm] MDOtherItemViewModel model)
        {
            string attachPath = string.Empty;

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

                if (message == "success")
                {
                    attachPath = fileName;
                }
            }

            OtherBrand type = new OtherBrand
            {
                Id          = (int)model.id,
                brandName   = model.typeName,
                brandNameBn = model.typeNameBn,
                brandFor    = model.brandFor,
                shortOrder  = model.shortOrder,
                imagePath   = attachPath
            };
            await electronicService.SaveOtherBrand(type);

            if (model.brandFor == "mobile")
            {
                return(RedirectToAction(nameof(OtherBrandMobile)));
            }
            else if (model.brandFor == "watch")
            {
                return(RedirectToAction(nameof(OtherBrandWatch)));
            }
            else if (model.brandFor == "shoes")
            {
                return(RedirectToAction(nameof(OtherBrandShoes)));
            }
            else if (model.brandFor == "bag")
            {
                return(RedirectToAction(nameof(OtherBrandBag)));
            }
            else if (model.brandFor == "electronics")
            {
                return(RedirectToAction(nameof(OtherBrandelEctronics)));
            }
            else if (model.brandFor == "jwellary")
            {
                return(RedirectToAction(nameof(OtherBrandelJwellary)));
            }
            else if (model.brandFor == "glass")
            {
                return(RedirectToAction(nameof(OtherBrandelGlass)));
            }
            else if (model.brandFor == "umbrella")
            {
                return(RedirectToAction(nameof(OtherBrandelUmbrella)));
            }
            else
            {
                return(RedirectToAction(nameof(OtherBrandMobile)));
            }
        }