Esempio n. 1
0
        public async Task <IActionResult> ContactPersonDetails(StoreDetailContactPersonDetails 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,
                        contactpersonname = model.contactpersonname,
                        emailaddress      = model.emailaddress,
                        gender            = model.gender,
                        contactno         = model.contactno,
                        isdeleted         = false
                                            // cityid=0

                                            // deliverytimeid = 0,
                                            // radiusid = 0
                    };
                    await storedetailsServices.CreateAsync(details);
                }
                else
                {
                    //store.id = idd;
                    store.contactpersonname = model.contactpersonname;
                    store.emailaddress      = model.emailaddress;
                    store.gender            = model.gender;
                    store.contactno         = model.contactno;
                    await storedetailsServices.UpdateAsync(store);
                }

                TempData["success"] = "Record Saved Successfully";
                return(RedirectToAction("ContactPersonDetails"));
                //return RedirectToAction("Index", "Home");
            }
            else
            {
                return(View(model));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> Lockunlock(string id)
        {
            var users = _storedetailsServices.GetAll().Where(x => x.storeid == id).FirstOrDefault();

            if (users == null)
            {
                ViewBag.ErrorMessgae = "User with id =" + id + "cannot be found";
                return(View("NotFound"));
            }
            else
            {
                if (users.status == "unavailable")
                {
                    users.status = "available";
                }
                else if (users.status == "available")
                {
                    users.status = "unavailable";
                }
                await _storedetailsServices.UpdateAsync(users);

                ViewBag.ErrorMessgae = "Status Update Successfully";
            }
            return(RedirectToAction("StoreListDetails"));
        }
Esempio n. 3
0
        public async Task <IActionResult> updateStoreStatus(string storeId, string status)
        {
            try
            {
                try
                {
                    var store = _storedetailsServices.GetAll().Where(x => x.storeid == storeId).FirstOrDefault();
                    if (store == null)
                    {
                        var details = new storedetails
                        {
                            storeid = storeId,
                            status  = status
                        };

                        int id = await _storedetailsServices.CreateAsync(details);

                        var store1 = _storedetailsServices.GetById(id);
                        return(Ok(store1));
                    }
                    else
                    {
                        //var store1 = _storedetailsServices.GetAll().Where(x => x.storeid == storeId).FirstOrDefault();
                        if (store == null)
                        {
                        }
                        else
                        {
                            store.status = status;

                            await _storedetailsServices.UpdateAsync(store);

                            return(Ok(store));
                        }
                    }
                }
                catch (Exception obj)
                {
                    //var details = new storedetails
                    //{
                    //    storeid = storeId,
                    //    storename = "",
                    //    contactpersonname = "",
                    //    // id = model.id,
                    //    radiusid = 0,
                    //    deliverytimeid = 0,
                    //    orderMinAmount =0,
                    //    packagingCharges =0,
                    //    isdeleted = false,
                    //    address ="",
                    //    description = "",
                    //    //storetime = model.storetime,
                    //    storetime = "",
                    //    latitude = "",
                    //    longitude = "",
                    //    cityid = 0,
                    //    promocode = "",
                    //    discount =0,

                    //    accountno = "",
                    //    banklocation = "",
                    //    bankname = "",
                    //    ifsccode = "",
                    //    status = status,
                    //    adminCommissionPer =0,
                    //    taxstatus = "",
                    //    taxstatusPer = 0



                    //};

                    //await _storedetailsServices.CreateAsync(details);
                    //var store = _storedetailsServices.GetAll().Where(x => x.storeid == storeId).FirstOrDefault();
                    //return Ok(store);
                }
                finally
                {
                }


                //  IEnumerable<storedetails> store = _storedetailsServices.GetAll().Where(x => x.storeid == storeId);

                return(BadRequest());
                //if (store == null)
                //{

                //    var details = new storedetails
                //    {
                //        storeid = storesId,
                //        status=status
                //        //storename = "",
                //        //contactpersonname = "",

                //        //radiusid = model.radiusid,
                //        //deliverytimeid = model.deliverytimeid,
                //        //orderMinAmount = model.orderMinAmount,
                //        //packagingCharges = model.packagingCharges,
                //        //isdeleted = false,
                //        //address = model.address,
                //        //description = model.description,
                //        ////storetime = model.storetime,
                //        //storetime = model.FromTime + " - " + model.ToTime,
                //        //latitude = model.latitude,
                //        //longitude = model.longitude,
                //        //cityid = model.cityid,
                //        //promocode = model.promocode,
                //        //discount = model.discount,

                //        //accountno = model.longitude,
                //        //banklocation = model.banklocation,
                //        //bankname = model.bankname,
                //        //ifsccode = model.ifsccode,
                //        //status = model.status,
                //        //adminCommissionPer = model.adminCommissionPer,
                //        //taxstatus = model.taxstatus,
                //        //taxstatusPer = model.taxstatusPer

                //    };

                //    await _storedetailsServices.CreateAsync(details);
                //    return Ok(store);
                //}
                //else
                //{


                //    store.status = status;

                //    await _storedetailsServices.UpdateAsync(store);
                //    return Ok(store);
                //}
            }
            catch (Exception obj)
            {
                return(Ok(obj.Message));
            }
        }