Exemplo n.º 1
0
        public ActionResult AjaxForm()
        {
            var model = new DistrictItem();

            if (DoAction == ActionType.Edit)
            {
                model = _api.GetDistrictItem(ArrId.FirstOrDefault());
            }
            ViewBag.listCity = _cityApi.GetAll();
            ViewBag.Action   = DoAction;
            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DistrictItem = await _context.Districts.SingleOrDefaultAsync(m => m.Id == id);

            if (DistrictItem == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DistrictItem = await _context.Districts.FindAsync(id);

            if (DistrictItem != null)
            {
                _context.Districts.Remove(DistrictItem);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }