示例#1
0
        public ActionResult GradeSelection(Models.GradeViewModel grade, string ButtonType)
        {
            if (ButtonType == "Next")
            {
                if (ModelState.IsValid)
                {
                    Entity.Applicant currentApplicant = GetApplicant();
                    SelectedGrade.ID = grade.ID;
                    Models.ApplicantBasicViewModel appViewModel = new Models.ApplicantBasicViewModel();

                    //if(currentApplicant.Contacts.Count!=0)
                    appViewModel = AutoMapper.Mapper.Map <Entity.Applicant, Models.ApplicantBasicViewModel>(currentApplicant);

                    //ModelState.Clear();
                    return(View("ApplicationForm", appViewModel));
                }
            }
            return(View());
        }
示例#2
0
        public ActionResult DocumentUpload(string ButtonType)
        {
            // return PartialView("Confirmation", app);

            Entity.Applicant currentApplicant = GetApplicant();
            if (ButtonType == "Back")
            {
                Models.ApplicantBasicViewModel applicantViewModel = AutoMapper.Mapper.Map <Entity.Applicant, Models.ApplicantBasicViewModel>(currentApplicant);

                return(View("ApplicationForm", applicantViewModel));
            }


            if (ButtonType == "Next")
            {
                return(View("Confirmation", currentApplicant));
            }


            return(View());
        }
示例#3
0
        public ActionResult ApplicationForm(Models.ApplicantBasicViewModel applicantData, string ButtonType)
        {
            // return PartialView("Confirmation", app);

            Entity.Applicant currentApplicant = GetApplicant();

            if (ButtonType == "Reset")
            {
                var NewModel = new Models.ApplicantBasicViewModel();
                ModelState.Clear();
                return(View(NewModel));
            }



            if (ButtonType == "Back")
            {
                Models.GradeViewModel grade = new Models.GradeViewModel();
                grade.ID = SelectedGrade.ID;
                // grade.Grade = _unitOfWork.Grade_Infos.Find(grade.ID).Grade;
                return(View("GradeSelection", grade));
            }


            if (ButtonType == "Next")
            {
                if (ModelState.IsValid)
                {
                    currentApplicant.FName  = applicantData.FName; //To-Do use automapper
                    currentApplicant.MName  = applicantData.MName;
                    currentApplicant.LName  = applicantData.LName;
                    currentApplicant.DOB    = applicantData.DOB;
                    currentApplicant.Gender = applicantData.Gender;

                    Entity.Address address = new Entity.Address();
                    address.Email = applicantData.Contact_Email;
                    address.PhoneBooks.Add(new Entity.PhoneBook()
                    {
                        Type = "Mobile", Phone = applicantData.Contact_MobilePhone
                    });
                    address.PhoneBooks.Add(new Entity.PhoneBook()
                    {
                        Type = "Office", Phone = applicantData.Contact_OfficePhone
                    });

                    Entity.Contact contact = new Entity.Contact()
                    {
                        FName = applicantData.Contact_FName, MName = applicantData.Contact_MName, Address = address
                    };

                    currentApplicant.Contacts.Add(contact);



                    return(View("DocumentUpload", GetDocuments()));
                }
            }


            return(View());
        }