Exemplo n.º 1
0
        public IActionResult Create(IFormCollection collection)
        {
            var entity = new ApprovalDto();

            TryUpdateModelAsync(entity);
            if (ModelState.IsValid)
            {
                var id = _service.Create(entity, CurrentUser.No, CurrentUser.Name, CurrentUser.DepartmentId);
                if (id > 0)
                {
                    return(RedirectToAction(nameof(Index)));
                }

                ModelState.AddModelError(string.Empty, "创建失败");
            }
            return(View(entity));
        }