示例#1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Dept dept)
        {
            if (ModelState.IsValid)
            {
                //_context.Add(dept);
                //await _context.SaveChangesAsync();
                await _deptService.Add(dept);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dept));
        }
示例#2
0
        /// <summary>
        /// 新增部门
        /// </summary>
        /// <param name="temp"></param>
        /// <returns></returns>
        public Boolean SaveNewDept(Dept temp)
        {
            try
            {
                temp.ID        = Guid.NewGuid();
                temp.IsDeleted = false;
                dept.Add(temp);
                return(true);
            }

            catch (Exception e)
            {
                return(false);
            }
        }