public ActionResult ParentSignUp(Parent parent)
 {
     if (ModelState.IsValid)
     {
         IParentRepo repo = new ParentRepo();
         repo.Insert(parent);
         TempData["welcome"] = "Your registration is completed succesfully!";
         return(RedirectToAction("Index", "Login"));
     }
     else
     {
         return(View(parent));
     }
 }
        private void btnStudentSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (FormMode == FormModes.View)
            {
                this.ActualParent.Close();
                return;
            }

            if (isValidate())
            {
                int _studentID = 0;

                if (FormMode == FormModes.New)
                {
                    int parentid = 0;
                    StudentDetail.created_by = StudentDetail.updated_by = ParentDetail.updated_by = ParentDetail.created_by = Utilities.UserSession.UserID;
                    StudentDetail.ClassID    = SelectedClassID;
                    if (ParentDetail.isNew)
                    {
                        parentid = ParentRepo.Insert(ParentDetail);
                    }
                    else
                    {
                        ParentRepo.Update(ParentDetail);
                        parentid = ParentDetail.ParentID;
                    }
                    StudentDetail.ParentID           = parentid;
                    StudentDetail.RegistrationNumber = "123123";
                    _studentID = StudentRepo.Insert(StudentDetail);
                    ClassStudentRepo.Insert(new ClassStudent {
                        ClassID = SelectedClassID, StudentID = _studentID, created_by = StudentDetail.created_by, updated_by = StudentDetail.updated_by
                    });
                }
                else if (FormMode == FormModes.Edit)
                {
                    StudentDetail.ParentID   = ParentDetail.ParentID;
                    StudentDetail.updated_by = ParentDetail.updated_by = Utilities.UserSession.UserID;
                    StudentDetail.ClassID    = SelectedClassID;
                    StudentRepo.Update(StudentDetail);
                    ParentRepo.Update(ParentDetail);
                    ClassStudentRepo.Update(new ClassStudent {
                        ClassID = SelectedClassID, StudentID = _studentID, updated_by = StudentDetail.updated_by
                    });
                }
                this.ActualParent.Close();
            }
        }