Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Mark,Date,EnrolleeId,ExaminerId,DisciplineId")] Exam exam)
        {
            if (ModelState.IsValid)
            {
                _context.Add(exam);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            LoadSelectLists();

            return(View(exam));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ExamPrice,Id,Surname,Name,Patronymic,Photo")] ExaminerViewModel examinerViewModel)
        {
            if (ModelState.IsValid)
            {
                string   uniqueFileName = UploadedFile(examinerViewModel);
                Examiner examiner       = new Examiner
                {
                    Surname    = examinerViewModel.Surname,
                    Name       = examinerViewModel.Name,
                    Patronymic = examinerViewModel.Patronymic,
                    Photo      = uniqueFileName,
                    ExamPrice  = examinerViewModel.ExamPrice
                };

                _context.Add(examiner);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(examinerViewModel));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(EnrolleeViewModel enrolleeViewModel)
        {
            if (ModelState.IsValid)
            {
                string uniqueFileName = UploadedFile(enrolleeViewModel);

                Enrollee enrollee = new Enrollee
                {
                    Surname    = enrolleeViewModel.Surname,
                    Name       = enrolleeViewModel.Name,
                    Patronymic = enrolleeViewModel.Patronymic,
                    Address    = enrolleeViewModel.Address,
                    BirthYear  = enrolleeViewModel.BirthYear,
                    Passport   = enrolleeViewModel.Passport,
                    Photo      = uniqueFileName
                };

                _context.Add(enrollee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(enrolleeViewModel));
        }