public IActionResult index() { var citydetails = _CityRegistrationservices.GetAll().Select(x => new CityIndexViewModel { id = x.id, stateid = x.stateid, cityName = x.cityName, StateRegistration = _StateRegistrationService.GetById(x.stateid), CountryRegistration = _CountryRegistrationservices.GetById(_StateRegistrationService.GetById(x.stateid).countryid) }).ToList(); return(View(citydetails)); }
public IActionResult Edit(int id) { ViewBag.Allcountry = _CountryRegistrationservices.GetAllCountry(); var objcountry = _StateRegistrationService.GetById(id); if (objcountry == null) { return(NotFound()); } var model = new StateEditViewModel { id = objcountry.id, countryid = objcountry.countryid, StateName = objcountry.StateName }; return(View(model)); }
public async Task <IActionResult> EditListUsers(string id) { var users = await usermanager.FindByIdAsync(id); ViewBag.Countries = _CountryRegistrationservices.GetAll().Select(x => new SelectListItem() { Text = x.countryname, Value = x.id.ToString() }); int countryiddd = 0, stateid = 0, countryid = 0; if (users.managerCity != null) { string cityiddd = users.managerCity; var paramter = new DynamicParameters(); paramter.Add("@cityId", cityiddd); var stateobj = _sP_Call.OneRecord <GetStatebyCityIdViewModel>("GetStatebyCityId", paramter); if (stateobj != null) { stateid = stateobj.stateid; } else { stateid = 0; } countryid = _StateRegistrationService.GetById(stateid).countryid; } if (users == null) { ViewBag.ErrorMessgae = "User with id =" + id + "cannot be found"; return(View("NotFound")); } var model = new EditRegisterViewModel() { Id = users.Id, Email = users.Email, name = users.name, mobileno = users.mobileno, gender = users.gender, UserName = users.UserName, managerCity = users.managerCity, multipleManagerCity = users.managerCity }; if (users.managerCity != null) { model.countryid = countryid; model.stateid = stateid; model.managerCity = users.managerCity; ViewBag.States = _StateRegistrationService.GetAll().Where(x => x.isdeleted == false && x.countryid == model.countryid).Select(x => new SelectListItem() { Text = x.StateName, Value = x.id.ToString() }); // ViewBag.Cities = _cityRegistrationservices.GetAll().Where(x => x.isdeleted == false && x.stateid == model.stateid).Select(x => new SelectListItem() // { // Text = x.cityName, // Value = x.id.ToString() // }); } return(View(model)); }
public async Task <IActionResult> StoreDetails() { ViewBag.Countries = _CountryRegistrationservices.GetAll().ToList(); ViewBag.radiusList = _RadiusMasterServices.GetAll().ToList(); ViewBag.deliveryList = _DeliveryTimeMasterServices.GetAll().ToList(); ApplicationUser usr = await GetCurrentUserAsync(); var id = usr.Id; var store = storedetailsServices.GetAll().Where(x => x.storeid == id).FirstOrDefault(); var model = new StoreDetailsViewModel(); if (store == null) { } else { // storename, radiusid, deliverytimeid, orderMinAmount, packagingCharges, storeBannerPhoto, //address, description, storetim int stateid = 0; int countryid = 0; int cityyid = 0; if (store.cityid == null) { } else { cityyid = Convert.ToInt32(store.cityid); stateid = _CityRegistrationservices.GetById(cityyid).stateid; countryid = _StateRegistrationService.GetById(stateid).countryid; } model.id = store.id; model.storename = store.storename; if (store.radiusid == null) { model.radiusid = 0; } else { model.radiusid = Convert.ToInt32(store.radiusid.ToString()); } if (store.deliverytimeid == null) { model.deliverytimeid = 0; } else { model.deliverytimeid = Convert.ToInt32(store.deliverytimeid.ToString()); } model.orderMinAmount = store.orderMinAmount; model.packagingCharges = store.packagingCharges; model.address = store.address; model.description = store.description; // model.storetime = store.storetime; if (store.storetime == null || store.storetime.ToString().Trim() == "".Trim()) { model.FromTime = ""; model.ToTime = ""; } else { string[] arr = store.storetime.Split("-"); if (arr.Length > 0) { model.FromTime = arr[0].ToString(); model.ToTime = arr[1].ToString(); } else { } } model.promocode = store.promocode; model.discount = store.discount; model.adminCommissionPer = store.adminCommissionPer; model.taxstatus = store.taxstatus; model.taxstatusPer = store.taxstatusPer; if (store.cityid == null) { } else { model.countryid = countryid; model.stateid = stateid; model.cityid = cityyid; } model.latitude = store.latitude; model.longitude = store.longitude; model.storeBannerPhotoName = store.storeBannerPhoto; model.accountno = store.accountno; model.bankname = store.bankname; model.banklocation = store.banklocation; model.ifsccode = store.ifsccode; model.status = store.status; ViewBag.States = _StateRegistrationService.GetAllState(model.countryid); ViewBag.Cities = _CityRegistrationservices.GetAllCity(model.stateid); } return(View(model)); }