Esempio n. 1
0
        // GET: Locations/Create
        public async Task <IActionResult> Create()
        {
            ViewBag.CountryList = AllCountry.getCountry();
            ViewBag.ParentList  = await _asyncRepository.ListAllAsync();

            return(View());
        }
        public async Task <IActionResult> Edit(int id, LocationViewModel locationViewModel)
        {
            string userId = User.Identity.Name;

            if (ModelState.IsValid)
            {
                await _locationViewModelService.UpdateLocationAsync(locationViewModel, userId);

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.CountryList = AllCountry.getCountry();
            return(View(locationViewModel));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, Location location)
        {
            if (ModelState.IsValid)
            {
                await _asyncRepository.UpdateAsync(location);

                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.CountryList = AllCountry.getCountry();
            ViewBag.ParentList  = await _asyncRepository.ListAllAsync();

            return(View(location));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create(Location collection)
        {
            if (ModelState.IsValid)
            {
                await _asyncRepository.AddAsync(collection);

                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.CountryList = AllCountry.getCountry();
            ViewBag.ParentList  = await _asyncRepository.ListAllAsync();

            return(View(collection));
        }
        public async Task <IActionResult> Edit(int id)
        {
            if (id <= 0)
            {
                return(RedirectToAction(nameof(Index)));
            }
            var locations = await _locationViewModelService.GetLocationAsync(id);

            if (locations == null)
            {
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.CountryList = AllCountry.getCountry();
            return(View(locations));
        }
Esempio n. 6
0
        public async Task <IActionResult> Edit(int id)
        {
            if (id <= 0)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var locations = await _asyncRepository.GetByIdAsync(id);

            if (locations == null)
            {
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.CountryList = AllCountry.getCountry();
            ViewBag.ParentList  = await _asyncRepository.ListAllAsync();

            return(View(locations));
        }
Esempio n. 7
0
 public IActionResult Create()
 {
     ViewBag.CountryList = AllCountry.getCountry();
     return(View());
 }