示例#1
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Departamento).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DepartamentoExists(Departamento.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
示例#2
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Pais.Add(Pais);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
示例#3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Pais = await _context.Pais.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
示例#4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Departamento = await _context.Departamento.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
示例#5
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            //  if (!ModelState.IsValid)
            //  {
            //   return Page();
            //    }

            var Ciudadtmp = await _context.Ciudad
                            .FirstOrDefaultAsync(m => m.Id == Ciudad.Id);

            Ciudadtmp.Id             = Ciudad.Id;
            Ciudadtmp.Nombre         = Ciudad.Nombre;
            Ciudadtmp.DepartamentoId = Ciudad.DepartamentoId;
            Ciudadtmp.Active         = Ciudad.Active;

            _context.Attach(Ciudadtmp).State = EntityState.Modified;

            try
            {
                //_context.Ciudad.Add(Ciudadtmp);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CiudadExists(Ciudad.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

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