예제 #1
0
        public JsonResult GetProductList(string bsGnd = "", string brand = "", string sidx = "ProductName", string sord = "asc", int rows = 3, int page = 1)
        {
            try
            {
                var currentShopId =
                    BSSecurityEncryption.Decrypt(bsGnd, WebAppConfig.GetConfigValue("BSGnd"));
                var param = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("shopId", currentShopId),
                    new KeyValuePair <string, string>("sortColumnName", sidx),
                    new KeyValuePair <string, string>("sortOrder", sord),
                    new KeyValuePair <string, string>("pageSize", Convert.ToString(rows)),
                    new KeyValuePair <string, string>("currentPage", Convert.ToString(page)),
                    new KeyValuePair <string, string>("brand", Convert.ToString(brand))
                };

                var data = new CommonAjaxCallToWebAPI().AjaxGet(@"/api/product/GetProductList", param, Convert.ToString(Session["BSWebApiToken"]));
                //  return Json(data, JsonRequestBehavior.AllowGet);

                var jqGridData = new JqGridType()
                {
                    Data       = data,
                    Page       = "1",
                    PageSize   = "3", // u can change this !
                    SortColumn = "1",
                    SortOrder  = "asc"
                };

                return(Json(jqGridData, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(null);
            }
        }
예제 #2
0
        private IApplicationHost CreateAppHost(Type appHostType, object appHostConfig,
                                               WebAppConfig appConfig,
                                               IListenerTransport listenerTransport, Type appHostTransportType, object appHostTransportConfig)
        {
            Logger.Write(LogLevel.Debug, "SimpleApplicationServer.CreateAppHost vhost={0}, vport={1}", appConfig.VHost, appConfig.VPort);
            try
            {
                IApplicationHost host = hostFactory.CreateApplicationHost(appHostType, appConfig.VHost, appConfig.VPort, appConfig.VPath, appConfig.RealPath);
                host.Configure(appHostConfig, appConfig, this, listenerTransport, appHostTransportType, appHostTransportConfig);
                //subscribe to Unload event only after run host.Configure
                //because apphost transport must unregister himself first
                host.HostUnload += OnHostUnload;

                lock (hosts) {
                    hosts.Add(new HostInfo()
                    {
                        Host                   = host,
                        AppHostType            = appHostType,
                        AppHostConfig          = appHostConfig,
                        AppConfig              = appConfig,
                        ListenerTransport      = listenerTransport,
                        AppHostTransportType   = appHostTransportType,
                        AppHostTransportConfig = appHostTransportConfig
                    });
                }
                return(host);
            } catch (Exception ex) {
                Logger.Write(LogLevel.Error, "Can't create host {0}", ex);
                return(null);
            }
        }
예제 #3
0
        internal static ControllerAction GetControllerAction(string url)
        {
            RouteResult routeResult = WebAppConfig.Router.Resolve(url);

            if (routeResult == null)
            {
                return(null);
            }

            ControllerClass controllerClass = WebAppConfig.GetControllerClass(routeResult.Controller);

            if (controllerClass != null)
            {
                ControllerAction controllerAction = new ControllerAction(controllerClass, routeResult.Action);

                foreach (KeyValuePair <string, string> param in routeResult.Parameters)
                {
                    controllerAction.Parameters.Add(param.Key, param.Value);
                }

                return(controllerAction);
            }

            return(null);
        }
예제 #4
0
        public async Task <ActionResult> AddProduct(AddProductViewModel model)
        {
            try
            {
                UserDetails        currentUser = GetCurrentUserDetails();
                HttpPostedFileBase file        = Request.Files["ImageData"];
                model.ProductImages = new List <TBL_ProductImages>();
                model.ProductImages.Add(new TBL_ProductImages()
                {
                    ProductID    = -1,
                    CreatedBy    = currentUser.UserId,
                    IsActive     = true,
                    ProductImage = CommonSafeConvert.ConvertToBytesFromFile(file)
                });
                model.ProductDetails.CreatedBy = currentUser.UserId;
                model.ProductDetails.ShopID    = GetCurrentShopId();
                if (ModelState.IsValid)
                {
                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(WebAppConfig.GetConfigValue("WebAPIUrl"));

                        // Add an Accept header for JSON format.
                        client.DefaultRequestHeaders.Accept.Clear();
                        client.DefaultRequestHeaders.Accept.Add(
                            new MediaTypeWithQualityHeaderValue("application/json"));
                        var response = await client.PostAsJsonAsync("/api/product/PostNewProduct", model);

                        if (response.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            var rslt = await response.Content.ReadAsStringAsync();

                            var reslt = new JavaScriptSerializer().Deserialize <BSEntityFramework_ResultType>(rslt);

                            foreach (var valerr in reslt.EntityValidationException)
                            {
                                ModelState.AddModelError("BS Errors", valerr);
                            }
                            //return reslt;
                            FillViewDatasForAddShop();
                            return(View());
                        }
                        else
                        {
                            FillViewDatasForAddShop();
                            return(View());
                        }
                    }
                }
                FillViewDatasForAddShop();
                return(View("AddProduct", model));
            }
            catch (Exception ex)
            {
                FillViewDatasForAddShop();
                return(View());
            }
        }
예제 #5
0
        private MiniSecurity()
        {
            string[] methods = WebAppConfig.GetSecurityMethods();

            foreach (string m in methods)
            {
                _methods.Add(m, 0);
            }
        }
예제 #6
0
        public void Init(HttpApplication app)
        {
            WebAppConfig.Init();

            app.PostResolveRequestCache  += PostResolveRequestCache;
            app.PostMapRequestHandler    += PostMapRequestHandler;
            app.PreRequestHandlerExecute += PreRequestHandlerExecute;
            app.ReleaseRequestState      += HttpCompressHander;
            app.PreSendRequestHeaders    += HttpCompressHander;
        }
예제 #7
0
        public ActionResult ViewProducts()
        {
            var shopId = GetCurrentShopId();

            ViewData["SpGnd"] = BSSecurityEncryption.Encrypt(Convert.ToString(shopId),
                                                             WebAppConfig.GetConfigValue("BSGnd"));
            FillViewDatasForAddShop();
            // return View(@"../shop/addshop");
            return(View());
        }
예제 #8
0
        internal static ControllerAction GetViewComponent(string name)
        {
            ControllerClass controllerClass = WebAppConfig.GetViewComponentClass(name);

            if (controllerClass == null)
            {
                return(null);
            }

            return(new ControllerAction(controllerClass));
        }
예제 #9
0
        public JsonResult GetProductList(string prodName      = "", string brandName = "", string barCode = "", string productType = "",
                                         string isAvailable   = "true",
                                         string availableQty  = "",
                                         string isActive      = "true",
                                         string prodCategory  = "",
                                         string prodSubType   = "",
                                         string prodMrp       = "",
                                         string prodShopPrice = "",
                                         string bsGnd         = "", string sidx = "ProductName", string sord = "asc", int rows = 3, int page = 1)
        {
            try
            {
                var currentShopId =
                    BSSecurityEncryption.Decrypt(bsGnd, WebAppConfig.GetConfigValue("BSGnd"));
                var param = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("prodName", prodName),
                    new KeyValuePair <string, string>("brandName", brandName),
                    new KeyValuePair <string, string>("barCode", barCode),
                    new KeyValuePair <string, string>("productType", productType),
                    new KeyValuePair <string, string>("isAvailable", isAvailable),
                    new KeyValuePair <string, string>("availableQty", availableQty),
                    new KeyValuePair <string, string>("isActive", isActive),
                    new KeyValuePair <string, string>("prodCategory", prodCategory),
                    new KeyValuePair <string, string>("prodSubType", prodSubType),
                    new KeyValuePair <string, string>("prodMrp", prodMrp),
                    new KeyValuePair <string, string>("prodShopPrice", prodShopPrice),
                    new KeyValuePair <string, string>("shopId", currentShopId),
                    new KeyValuePair <string, string>("sortColumnName", sidx),
                    new KeyValuePair <string, string>("sortOrder", sord),
                    new KeyValuePair <string, string>("pageSize", Convert.ToString(rows)),
                    new KeyValuePair <string, string>("currentPage", Convert.ToString(page)),
                };

                var data = new CommonAjaxCallToWebAPI().AjaxGet(@"/api/product/GetProductListView", param
                                                                , Convert.ToString(Session["BSWebApiToken"]));
                //  return Json(data, JsonRequestBehavior.AllowGet);

                var jqGridData = new JqGridType()
                {
                    Data       = data,
                    Page       = "1",
                    PageSize   = "3", // u can change this !
                    SortColumn = "1",
                    SortOrder  = "asc"
                };

                return(Json(jqGridData, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(null);
            }
        }
예제 #10
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            WebAppConfig.Register(GlobalConfiguration.Configuration);

            AutoFacConfig.ConfigureDependencyInjection();
        }
예제 #11
0
        public static void CreateContext(OfflineWebSession webSession, string method, string url, NameValueCollection postData)
        {
            WebAppConfig.Init(webSession.MapPath);

            HttpContextBase context = new OfflineHttpContext(webSession, method, url, postData);

            Current = context;

            context.SessionObject = WebAppHelper.CreateSessionObject();

            WebAppConfig.Fire_SessionCreated(context.SessionObject);
        }
예제 #12
0
        private void FillViewDatasForAddShopOffers()
        {
            var shopId = GetCurrentShopId();
            Dictionary <string, List <SelectListItem> > selectListData = new Dictionary <string, List <SelectListItem> >();
            var brandList = GetShopBrandList(shopId);

            selectListData.Add("ShopBrandList", brandList);
            ViewData["SelectListData"] = selectListData;

            ViewData["SpGnd"] = BSSecurityEncryption.Encrypt(Convert.ToString(shopId),
                                                             WebAppConfig.GetConfigValue("BSGnd"));
        }
예제 #13
0
        public IApplicationHost CreateApplicationHost(Type appHostType, object appHostConfig,
                                                      object webAppConfig,
                                                      IListenerTransport listenerTransport, Type appHostTransportType, object appHostTransportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig == null)
            {
                Logger.Write(LogLevel.Error, "Web application is not specified");
                return(null);
            }

            return(CreateAppHost(appHostType, appHostConfig, appConfig, listenerTransport, appHostTransportType, appHostTransportConfig));
        }
예제 #14
0
 public override void Execute(HttpContextBase httpContext)
 {
     try
     {
         httpContext.Response.RenderedView = View;
         httpContext.Response.AppendHeader("X-Powered-By", "ThinkAway MVC v" + WebAppConfig.Version);
         httpContext.Response.Write(View.Render());
     }
     catch (TemplateNotFoundException templateException)
     {
         if (!WebAppConfig.Fire_TemplateNotFound(httpContext.Request.RawUrl))
         {
             httpContext.Response.Write(templateException.Message);
         }
     }
 }
예제 #15
0
        public static void CreateContext(HttpContext httpContext)
        {
            WebAppConfig.Init();

            HttpContextBase context = new OnlineHttpContext(httpContext);

            Current = context;

            if (httpContext.Session == null)
            {
                return;
            }

            context.SessionObject = WebAppHelper.CreateSessionObject();

            WebAppConfig.Fire_SessionCreated(context.SessionObject);
        }
예제 #16
0
파일: Startup.cs 프로젝트: nargiz/favbook
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration config = new HttpConfiguration();

            AuthorizationConfig.RegisterOAuth(app);
            WebApiConfig.RegisterRoutes(config);
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            app.UseWebApi(config);

            WebAppConfig.RegisterRoutes(RouteTable.Routes);
            UnityConfig.RegisterComponents(config);
            SwaggerConfig.Register(config);

            AutoMapper.Mapper.Initialize(cfg => cfg.AddProfile <AutoMapperConfig>());

            Database.SetInitializer(new MigrateDatabaseToLatestVersion <FavBooksContext, FavBooks.DataAccess.Migrations.Configuration>());
        }
예제 #17
0
        public JsonResult GetOffersList(string offerShortDetails = "", string offerStartDate = "", string offerEndDate = "", string offerOnBrand = "",
                                        string isOfferOnProduct  = null,
                                        string isActive          = null,
                                        string bsGnd             = "",
                                        string sord = "asc", int rows = 3, int page = 1, string sidx = "OfferID")
        {
            try
            {
                var currentShopId =
                    BSSecurityEncryption.Decrypt(bsGnd, WebAppConfig.GetConfigValue("BSGnd"));
                var param = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("offerShortDetails", offerShortDetails),
                    new KeyValuePair <string, string>("offerStartDate", offerStartDate),
                    new KeyValuePair <string, string>("offerEndDate", offerEndDate),
                    new KeyValuePair <string, string>("offerOnBrand", offerOnBrand),
                    new KeyValuePair <string, string>("isOfferOnProduct", isOfferOnProduct),
                    new KeyValuePair <string, string>("isActive", isActive),
                    new KeyValuePair <string, string>("shopId", currentShopId),
                    new KeyValuePair <string, string>("sortColumnName", sidx),
                    new KeyValuePair <string, string>("sortOrder", sord),
                    new KeyValuePair <string, string>("pageSize", Convert.ToString(rows)),
                    new KeyValuePair <string, string>("currentPage", Convert.ToString(page)),
                };

                var data = new CommonAjaxCallToWebAPI().AjaxGet(@"api/shopoffers/GetShopOffersListView", param
                                                                , Convert.ToString(Session["BSWebApiToken"]));
                //  return Json(data, JsonRequestBehavior.AllowGet);

                var jqGridData = new JqGridType()
                {
                    Data       = data,
                    Page       = "1",
                    PageSize   = "3", // u can change this !
                    SortColumn = "1",
                    SortOrder  = "asc"
                };

                return(Json(jqGridData, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(null);
            }
        }
예제 #18
0
        private static void PostMapRequestHandler(object sender, EventArgs e)
        {
            WebAppConfig.Init();

            HttpContext httpContext = ((HttpApplication)sender).Context;

            RequestData requestData = (httpContext.Items[_contextItemKey] as RequestData);

            if (requestData != null)
            {
                httpContext.RewritePath(requestData.Url);

                if (requestData.Handler != null)
                {
                    httpContext.Handler = requestData.Handler;
                }
            }
        }
예제 #19
0
        public virtual void Configure(object appHostConfig, object webAppConfig,
                                      IApplicationServer server,
                                      IListenerTransport listenerTransport,
                                      Type appHostTransportType, object transportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig != null)
            {
                vport = appConfig.VPort;
                vhost = appConfig.VHost;
                vpath = appConfig.VPath;
                path  = appConfig.RealPath;
            }

            appServer = server;
            this.listenerTransport = listenerTransport;
            appHostTransport       = (IApplicationHostTransport)Activator.CreateInstance(appHostTransportType);
            appHostTransport.Configure(this, transportConfig);
        }
예제 #20
0
        public JsonResult GetPostalsAutoComplete(string hint)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri(WebAppConfig.GetConfigValue("WebAPIUrl"));

            // Add an Accept header for JSON format.
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            HttpResponseMessage response = client.GetAsync("/api/common?hint=" + hint).Result;

            if (response.IsSuccessStatusCode)
            {
                var rslt = response.Content.ReadAsStringAsync().Result;
                return(Json(new JavaScriptSerializer().Deserialize <object>(rslt), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
예제 #21
0
        public virtual void Configure(object appHostConfig, object webAppConfig,
                                      IApplicationServer server,
                                      IListenerTransport listenerTransport,
                                      Type appHostTransportType, object transportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig != null)
            {
                vport = appConfig.VPort;
                vhost = appConfig.VHost;
                vpath = appConfig.VPath;
                path  = appConfig.RealPath;
            }

            appServer              = server;
            physicalRoot           = server.PhysicalRoot;
            this.listenerTransport = listenerTransport;
            appHostTransport       = (IApplicationHostTransport)Activator.CreateInstance(appHostTransportType);
            appHostTransport.Configure(this, transportConfig);
            Logger.Write(LogLevel.Debug, "Configured host in domain {0}, id={1}", AppDomain.CurrentDomain.FriendlyName, AppDomain.CurrentDomain.Id);
        }
예제 #22
0
        private static void PostResolveRequestCache(object sender, EventArgs e)
        {
            WebAppConfig.Init();

            HttpContext httpContext = ((HttpApplication)sender).Context;
            HttpRequest httpRequest = httpContext.Request;

            IHttpHandler httpHandler = null;

            string path = UrlHelper.GetUrlPath(httpRequest.AppRelativeCurrentExecutionFilePath, httpRequest.PathInfo);

            if (path.StartsWith("_$ajax$_.axd/"))
            {
                httpHandler = new AjaxPageHandler(path);
            }
            else if (path.StartsWith("_$res$_.axd"))
            {
                httpHandler = new ResourceHttpHandler(path);
            }
            else
            {
                ControllerAction controllerAction = WebAppHelper.GetControllerAction(path);

                if (controllerAction != null)
                {
                    httpHandler = new PageHandler(new MvcPageHandler(controllerAction));
                }
            }

            if (httpHandler != null)
            {
                httpContext.Items[_contextItemKey] = new RequestData(httpContext.Request.RawUrl, httpHandler);

                httpContext.RewritePath("~/ProMesh.axd");
            }
        }
예제 #23
0
        public void TestUrlWithHttpsAndNoPath()
        {
            var webApp = new WebAppConfig("https://localhost:1234");

            Assert.AreEqual("https://localhost:1234", webApp.NgrokAddress);
        }
예제 #24
0
 public AzureStorageClient(WebAppConfig config)
 {
     _storageConfig = config;
 }
예제 #25
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("./secrets.json")
                          .AddEnvironmentVariables("WEB_");

            IConfigurationRoot root = builder.Build();

            config = new WebAppConfig();
            ConfigurationBinder.Bind(root, config);

            services.AddSingleton <WebAppConfig>(config);


            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            //services.AddAzureAdV2Authentication(Configuration);

            //services.AddMvc(o =>
            //{
            //    o.Filters.Add(new AuthorizeFilter("default"));
            //}).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);



            services.AddAuthorization(o =>
            {
                o.AddPolicy("default", policy =>
                {
                    // Require the basic "Access app-name" claim by default
                    policy.RequireClaim("http://schemas.microsoft.com/identity/claims/scope", "user_impersonation");
                });
            });

            services
            .AddAuthentication(o =>
            {
                o.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(o =>
            {
                o.Authority = Configuration["Authentication:Authority"];
                o.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
                {
                    // Both App ID URI and client id are valid audiences in the access token
                    ValidAudiences = new List <string>
                    {
                        config.AppId,
                        config.ClientId
                    }
                };
            });
            // Add claims transformation to split the scope claim value
            services.AddSingleton <IClaimsTransformation, AzureAdScopeClaimTransformation>();


            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
예제 #26
0
 public HomeController(WebAppConfig config)
 {
     this.config = config;
 }
예제 #27
0
        public void TestUrlNoHttps()
        {
            var webApp = new WebAppConfig("http://localhost:1234/");

            Assert.AreEqual("localhost:1234", webApp.NgrokAddress);
        }
예제 #28
0
        public void TestPortNumberOnly()
        {
            var webApp = new WebAppConfig("1234");

            Assert.AreEqual("localhost:1234", webApp.NgrokAddress);
        }
예제 #29
0
        public async Task <ActionResult> EditOffer(ProductUpdateForm formDATA)
        {
            var                 ProductDetails = new JavaScriptSerializer().Deserialize <TBL_Products>(formDATA.ProductDetails);
            UserDetails         currentUser    = GetCurrentUserDetails();
            AddProductViewModel model          = new AddProductViewModel();

            model.ProductDetails = ProductDetails;
            if (formDATA.file != null)
            {
                model.ProductImages = new List <TBL_ProductImages>();
                model.ProductImages.Add(new TBL_ProductImages()
                {
                    ImageID      = CommonSafeConvert.ToInt(formDATA.imgId),
                    ProductID    = ProductDetails.ProductID,
                    UpdatedBy    = currentUser.UserId,
                    UpdateDate   = DateTime.Now,
                    IsActive     = true,
                    ProductImage = CommonSafeConvert.ConvertToBytesFromFile(formDATA.file)
                });
            }

            if (ModelState.IsValid)
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(WebAppConfig.GetConfigValue("WebAPIUrl"));

                    // Add an Accept header for JSON format.
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(
                        new MediaTypeWithQualityHeaderValue("application/json"));
                    var response = new CommonAjaxCallToWebAPI().AjaxPost("/api/product/PostEditProduct", model, Convert.ToString(Session["BSWebApiToken"])).Result;
                    //  var response = await client.PostAsJsonAsync("/api/product/PostEditProduct", model);

                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        var rslt = await response.Content.ReadAsStringAsync();

                        var reslt = new JavaScriptSerializer().Deserialize <BSEntityFramework_ResultType>(rslt);
                        if (reslt.Result == BSResult.FailForValidation)
                        {
                            foreach (var valerr in reslt.EntityValidationException)
                            {
                                ModelState.AddModelError("BS Errors", valerr);
                            }
                        }
                        //return reslt;
                        //FillViewDatasForAddShop();
                        var allErrors = ModelState.Values.SelectMany(v => v.Errors);
                        return(Json(allErrors, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json("Failed", JsonRequestBehavior.AllowGet));
                    }
                }
            }
            return(Json(new
            {
                Valid = ModelState.IsValid,
                UserID = currentUser.UserId,
                //Errors = GetErrorsFromModelState(),
                Status = "Validation Failed"
            }));
        }
예제 #30
0
        public async Task <ActionResult> AddShopOffer(AddShopOffersViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var client = new HttpClient())
                    {
                        var currentUserId = CommonSafeConvert.ToInt(Session["CurrentUserID"]);
                        model.ShopOffer.ShopID    = GetCurrentShopId();
                        model.ShopOffer.CreatedBy = currentUserId;

                        var selectedProductList = new JavaScriptSerializer().Deserialize <List <SelectedProductList> >(model.SelectedProductJson);
                        model.OfferonProducts = new List <TBL_OfferOnProducts>();
                        selectedProductList.ForEach(x => model.OfferonProducts.Add(new TBL_OfferOnProducts()
                        {
                            ProductID = x.ProductID, OfferID = model.ShopOffer.OfferID
                        }));

                        client.BaseAddress = new Uri(WebAppConfig.GetConfigValue("WebAPIUrl"));
                        client.DefaultRequestHeaders.Accept.Clear();
                        client.DefaultRequestHeaders.Accept.Add(
                            new MediaTypeWithQualityHeaderValue("application/json"));
                        var response = await client.PostAsJsonAsync("/api/shopoffers/PostNewShopOffers", model);

                        // var response = new CommonAjaxCallToWebAPI().AjaxPost(@"/api/shopoffers/PostNewShopOffers", model);

                        if (response.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            var rslt = await response.Content.ReadAsStringAsync();

                            var reslt = new JavaScriptSerializer().Deserialize <BSEntityFramework_ResultType>(rslt);
                            if (reslt.Result == BSResult.FailForValidation)
                            {
                                foreach (var valerr in reslt.EntityValidationException)
                                {
                                    ModelState.AddModelError("BS Errors", valerr);
                                }
                            }
                            else
                            {
                                ModelState.AddModelError("BS Errors", reslt.ResultMsg);
                            }
                            //return reslt;
                            FillViewDatasForAddShopOffers();
                            return(View());
                        }
                        else
                        {
                            FillViewDatasForAddShopOffers();
                            return(View());
                        }
                    }
                }
                FillViewDatasForAddShopOffers();
                return(View("AddShopOffer", model));
            }
            catch (Exception ex)
            {
                FillViewDatasForAddShopOffers();
                return(View());
            }
        }