// 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());
            }
            var entry = _context.Add(new InfoAuto());

            entry.CurrentValues.SetValues(InfoAuto);

            await _context.SaveChangesAsync();

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

            RimborsoKm = await _context.Rimborsi.FindAsync(id);

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

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