public ActionResult Create(RegistrationStudent student, PrijavaZaKonkurs form)
        {
            //RegistrationStudent student = new RegistrationStudent();

            UpdateModel(student);

            //if (form._fileUploadIncomingDoc.HasFile)
            //{
            //    student.incomingDocumentName = Server.MapPath("") + "\\TemporaryData";
            //    student.incomingDocumentName += "\\";
            //    student.incomingDocumentName += form._fileUploadIncomingDoc.PostedFile.FileName;
            //    form._fileUploadIncomingDoc.PostedFile.SaveAs(student.incomingDocumentName);
            //}

            //if (form._fileUploadFacultyDoc.HasFile)
            //{
            //    student.facultyDocumentName = Server.MapPath("") + "\\TemporaryData";
            //    student.facultyDocumentName += "\\";
            //    student.facultyDocumentName += form._fileUploadFacultyDoc.PostedFile.FileName;
            //    form._fileUploadFacultyDoc.PostedFile.SaveAs(student.facultyDocumentName);
            //}

            new StudentService().AddNewStudent(student);

            return(RedirectToAction("Details", new { id = student.id }));
        }
        public ActionResult Registration([Bind(Include = "Id,Name,Surname,Email,University,Course")] RegistrationStudent student)
        {
            student.TrainingId = (int)TempData["Id"];

            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                TempData["Massage"] = "Регистрация прошла успешно.";
                return(RedirectToAction("ShowMassage"));
            }
            TempData["Id"] = student.Id;
            return(View(student));
        }
        //
        // GET: /Registration/Create
        public ActionResult Create()
        {
            RegistrationStudent student = new RegistrationStudent();

            return(View(student));
        }
        /// <summary>
        /// This button handler generates a new instance of REGISTRATION_STUDENT and initializes
        /// the attributes with data from the "PRIJAVA_ZA_KONKURS.ASPX" page. If the files were choosen,
        /// they would be saved on the server as normal documents and been later in STUDENT_SERVICE
        /// stored to the database. At the end the user would be redirected to see details about
        /// the information which he saved to the database
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void _btnWriteNewStudent_Click(object sender, EventArgs e)
        {
            RegistrationStudent student = new RegistrationStudent();

            student.personalNumber = Int32.Parse(this._txtPersonalNumber.Text);

            var studentCheck = new StudentService().GetStudentByPersonalNo(student.personalNumber);

            if (studentCheck.name != null)
            {
                Response.Write("Vec postoji student sa istim JMBG");
            }
            else
            {
                student.name    = this._txtName.Text;
                student.surname = this._txtSurname.Text;
                if (this._rBtnMale.Checked)
                {
                    student.gender = EGender.male;
                }

                else
                {
                    student.gender = EGender.female;
                }

                student.email       = this._txtEMail.Text;
                student.phoneNumber = Int32.Parse(this._txtPhoneNumber.Text);

                student.faculty     = this._txtFacultyName.Text;
                student.enrollYear  = Int32.Parse(this._txtEnrollYear.Text);
                student.studyYear   = Int32.Parse(this._txtStudyYear.Text);
                student.indexNumber = Int32.Parse(this._txtIndexNumber.Text);

                switch (this._dropDownDormName.SelectedIndex)
                {
                case 0:
                    student.dorm = EDorm.pavilion1;
                    break;

                case 1:
                    student.dorm = EDorm.pavilion2;
                    break;

                case 2:
                    student.dorm = EDorm.pavilion3;
                    break;

                default:
                    student.dorm = EDorm.pavilion4;
                    break;
                }

                if (this._fileUploadIncomingDoc.HasFile)
                {
                    student.incomingDocumentName  = Server.MapPath("") + "\\TemporaryData";
                    student.incomingDocumentName += "\\";
                    student.incomingDocumentName += this._fileUploadIncomingDoc.PostedFile.FileName;
                    this._fileUploadIncomingDoc.PostedFile.SaveAs(student.incomingDocumentName);
                }

                if (this._fileUploadFacultyDoc.HasFile)
                {
                    student.facultyDocumentName  = Server.MapPath("") + "\\TemporaryData";
                    student.facultyDocumentName += "\\";
                    student.facultyDocumentName += this._fileUploadFacultyDoc.PostedFile.FileName;
                    this._fileUploadFacultyDoc.PostedFile.SaveAs(student.facultyDocumentName);
                }

                new StudentService().AddNewStudent(student);

                File.Delete(student.incomingDocumentName);
                File.Delete(student.facultyDocumentName);

                student.incomingDocumentName = null;
                student.facultyDocumentName  = null;

                Response.Redirect("Registration/Details/" + student.id.ToString());
            }
        }