public async Task <IActionResult> Create([Bind("Id,Nomi")] Subject subject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(subject));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Nomi,ProfessionId,Grade")] Group @group)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@group);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProfessionId"] = new SelectList(_context.Professions, "Id", "Nomi", @group.ProfessionId);
            return(View(@group));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Id,Nomi,Surname,Sharif,Manzil,GroupId")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GroupId"] = new SelectList(_context.Groups, "Id", "Nomi", student.GroupId);
            return(View(student));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("Id,GroupId,SubjectId")] GroupSubject groupSubject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(groupSubject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GroupId"]   = new SelectList(_context.Groups, "Id", "Nomi", groupSubject.GroupId);
            ViewData["SubjectId"] = new SelectList(_context.Subjects, "Id", "Nomi", groupSubject.SubjectId);
            return(View(groupSubject));
        }
        public async Task <IActionResult> Create([Bind("Id,StudentId,S1,S2,S3,S4,Q1,Q2,Q3,Q4,Olimpiada,Tanlov")] Mark mark)
        {
            if (ModelState.IsValid)
            {
                List <long> li = new List <long>();
                foreach (var m in _context.Marks)
                {
                    li.Add((long)m.StudentId);
                }
                if (li.IndexOf((long)mark.StudentId) == -1)
                {
                    _context.Add(mark);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            ViewData["StudentId"] = new SelectList(_context.Students, "Id", "Nomi", mark.StudentId);
            return(View(mark));
        }