Exemplo n.º 1
0
        public IActionResult Supplement(int id, IFormCollection collection)
        {
            var dto = new SupplementDto();

            TryUpdateModelAsync(dto);

            if (ModelState.IsValid)
            {
                var result = _service.Supplement(id, dto);
                if (result > 0)
                {
                    return(RedirectToAction(nameof(Index)));
                }

                ModelState.AddModelError(string.Empty, "更新失败");
            }

            return(View(dto));
        }