public async Task <IActionResult> Service(RequestedServiceDto serviceDto)
        {
            var service = new RequestService
            {
                CityFromId  = serviceDto.fromCity,
                CityToId    = serviceDto.toCity,
                Address     = serviceDto.Address,
                Email       = serviceDto.Email,
                FullName    = serviceDto.Name,
                Phone       = serviceDto.Phone,
                RequestDate = DateTime.Now,
            };
            await _repo.AddOrder(service);

            await _repo.SaveChanges();

            return(RedirectToAction("thanks", "Home"));
        }
예제 #2
0
        public async Task <ActionResult> Index(TrackDto trackDto)
        {
            if (ModelState.IsValid)
            {
                var service = new RequestService
                {
                    CityFromId  = trackDto.fromCity,
                    CityToId    = trackDto.toCity,
                    RequestDate = DateTime.Now,
                };
                await _repo.AddOrder(service);

                await _repo.SaveChanges();

                return(Redirect("Home/index"));
            }
            else
            {
                var cities = await _repo.GetKsacities();

                trackDto.Ksacities = cities;
                return(View(trackDto));
            }
        }