// 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)); }
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)); }
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)); }
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)); }
public IActionResult Create() { ViewBag.CountryList = AllCountry.getCountry(); return(View()); }