Ejemplo n.º 1
0
        public DbResponse StoreUpdate(VendorInfoUpdateModel model, string vendorUserName)
        {
            try
            {
                var vendorId = _db.Registration.VendorIdByUserName(vendorUserName);
                if (vendorId == 0)
                {
                    return(new DbResponse(false, "Invalid User"));
                }

                model.VendorId = vendorId;

                if (_db.Vendor.IsNull(vendorId))
                {
                    return(new DbResponse(false, "Vendor ID Not Found"));
                }

                _db.Vendor.StoreInfoUpdate(model);
                _db.SaveChanges();

                return(new DbResponse(true, "Success"));
            }
            catch (Exception e)
            {
                return(new DbResponse(false, e.Message));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> ProfileUpdate(VendorInfoUpdateModel model, VendorInfoDocFile files)
        {
            model.StoreLogoFileName = await _cloudStorage.UpdateFileAsync(files.FileStoreLogo, model.StoreLogoFileName, "store-logo");

            model.StoreBannerFileName = await _cloudStorage.UpdateFileAsync(files.FileStoreBanner, model.StoreBannerFileName, "store-banner");

            model.NIdImageBackFileName = await _cloudStorage.UpdateFileAsync(files.FileNidPhotoBack, model.NIdImageBackFileName, "nid");

            model.NIdImageFrontFileName = await _cloudStorage.UpdateFileAsync(files.FileNidPhotoFront, model.NIdImageFrontFileName, "nid");

            model.ChequeImageFileName = await _cloudStorage.UpdateFileAsync(files.FileChequeCopy, model.ChequeImageFileName, "cheque");

            model.TradeLicenseImageFileName = await _cloudStorage.UpdateFileAsync(files.FileTradeLicense, model.TradeLicenseImageFileName, "trade-license");

            //multiple certificate insert
            if (files.FileOthersCertificate != null)
            {
                if (model.VendorCertificateFileNames != null)
                {
                    foreach (var s in model.VendorCertificateFileNames)
                    {
                        await _cloudStorage.DeleteFileAsync(FileBuilder.FileNameFromUrl(s));
                    }
                }

                var newFile = new List <string>();
                foreach (var file in files.FileOthersCertificate)
                {
                    newFile.Add(await _cloudStorage.UploadFileAsync(file, FileBuilder.FileNameImage("certificate", file.FileName)));
                }

                model.VendorCertificateFileNames = newFile.ToArray();
            }

            var response = _vendor.StoreUpdate(model, User.Identity.Name);

            return(Json(response));
        }