Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(decimal id, [Bind("ID,BASEADDRESS")] SampleStreet sampleStreet)
        {
            if (id != sampleStreet.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sampleStreet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SampleStreetExists(sampleStreet.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sampleStreet));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,BASEADDRESS")] SampleStreet sampleStreet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sampleStreet);
                await _context.SaveChangesAsync();

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