예제 #1
0
        public IActionResult Edit(int id, [Bind("Name,Id,TimeStamp")] Make make)
        {
            if (id != make.Id)
            {
                return(NotFound());
            }

            _repo.Update(make);
            return(RedirectToAction(nameof(Index)));
        }
예제 #2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            try
            {
                _repo.Update(Make);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                return(Page());
            }

            return(RedirectToPage("./Index"));
        }
예제 #3
0
        public IActionResult Edit(int id, [Bind("Name,Id,TimeStamp")] Make make)
        {
            if (id != make.Id)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                return(View(make));
            }

            try
            {
                _repo.Update(make);
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                return(View(make));
            }
        }