Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }