Example #1
0
        public async Task <IActionResult> Services()
        {
            ApplicationUser usr = await GetCurrentUserAsync();

            var id    = usr.Id;
            var store = storedetailsServices.GetAll().Where(x => x.storeid == id).FirstOrDefault();
            var model = new StoreDetailServicesDetails();

            if (store == null)
            {
            }
            else
            {
                model.id           = store.id;
                model.fooddelivery = store.fooddelivery;
            }


            return(View(model));
        }
Example #2
0
        public async Task <IActionResult> Services(StoreDetailServicesDetails model)
        {
            if (ModelState.IsValid)
            {
                ApplicationUser usr = await GetCurrentUserAsync();

                var id = usr.Id;
                //  var idd = storedetailsServices.GetAll().Where(x => x.storeid == id).FirstOrDefault().id;

                var store = storedetailsServices.GetAll().Where(x => x.storeid == id).FirstOrDefault();

                if (store == null)
                {
                    var details = new storedetails
                    {
                        storeid = id,
                        // id = model.id,
                        fooddelivery      = model.fooddelivery,
                        contactpersonname = "",
                        isdeleted         = false,
                        // deliverytimeid = 0,
                        // radiusid = 0
                    };
                    await storedetailsServices.CreateAsync(details);
                }
                else
                {
                    //store.id = idd;
                    store.fooddelivery = model.fooddelivery;

                    await storedetailsServices.UpdateAsync(store);
                }


                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View(model));
            }
        }