示例#1
0
        public async Task <IActionResult> Create([Bind("Id,Mfullname,Ffullname")] Parent parent)
        {
            if (ModelState.IsValid)
            {
                _context.Add(parent);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(parent));
        }
        public async Task <IActionResult> Create([Bind("Id,PositionName")] Position position)
        {
            if (ModelState.IsValid)
            {
                _context.Add(position);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(position));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("Id,NameOfType,Note")] GroupType groupType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(groupType);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            return(View(groupType));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("Id,FullName,Adress,Phone,PositionId,Info,Reward")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staff);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PositionId"] = new SelectList(_context.Positions, "Id", "Id", staff.PositionId);
            return(View(staff));
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("Id,FullName,BirthDate,Gender,ParentId,Adress,GroupId,Note,OtherGroup")] Child child)
        {
            if (ModelState.IsValid)
            {
                _context.Add(child);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GroupId"]  = new SelectList(_context.Groups, "Id", "Id", child.GroupId);
            ViewData["ParentId"] = new SelectList(_context.Parents, "Id", "Id", child.ParentId);
            return(View(child));
        }
示例#6
0
        public async Task <IActionResult> Create([Bind("Id,GroupName,StaffId,CountOfChildren,YearOfCreation,TypeId")] Group @group)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@group);
                await _context.SaveChangesAsync();

                _cache.Clean();
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StaffId"] = new SelectList(_context.Staff, "Id", "Id", @group.StaffId);
            ViewData["TypeId"]  = new SelectList(_context.GroupTypes, "Id", "Id", @group.TypeId);
            return(View(@group));
        }