Beispiel #1
0
        // GET: LocationService
        public ActionResult Index()
        {
            if (!String.IsNullOrEmpty(User.Identity.Name))
            {
                var resultList = unitOfWork.GetServiceLocationByUsername(User.Identity.Name);

                if (resultList != null)
                {
                    var serviceLocList = new List <PointOfServiceViewModel>();

                    foreach (var r in resultList)
                    {
                        var serviceLoc = new PointOfServiceViewModel()
                        {
                            City  = r.City,
                            State = r.State
                        };
                        serviceLocList.Add(serviceLoc);
                    }

                    return(View(serviceLocList));
                }

                return(View(new List <PointOfServiceViewModel>()));
            }

            return(RedirectToAction("Login", "Account"));
        }
Beispiel #2
0
 public ActionResult Create(PointOfServiceViewModel pos)
 {
     try
     {
         if (ModelState.IsValid)
         {
             unitOfWork.InsertServiceLocationByProfileUsername(int.Parse(pos.City), User.Identity.Name);
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Beispiel #3
0
        // GET: LocationService/Create
        public ActionResult Create()
        {
            var model       = new PointOfServiceViewModel();
            var resultState = unitOfWork.GetStateByCountryCode("PH").FirstOrDefault().State;
            var cityList    = new List <SelectListItem>();
            var resultCity  = unitOfWork.GetCityByState(resultState);

            foreach (var res in resultCity)
            {
                cityList.Add(new SelectListItem()
                {
                    Text = res.City, Value = res.CityId.ToString()
                });
            }
            model.CityList = cityList;
            model.State    = resultState;
            return(View(model));
        }