public ActionResult AddEmployee(SignUpViewModel signUpViewModel) { try { var user = new User(); var employee = new Employee(); var signuphelper = new SignUpHelper(); user = signuphelper.GetUserobj(signUpViewModel); var result = _userService.Save(user); var userid = _userService.GetLastId(signUpViewModel.Email); signUpViewModel.UserId = userid.Data; employee = signuphelper.GetEmployeeobj(signUpViewModel); var result2 = _employeeService.Save(employee); if (result.HasError) { ViewBag.Message = result.Message; return(Content(result.Message)); } if (result2.HasError) { ViewBag.Message = result2.Message; return(Content(result2.Message)); } return(RedirectToAction("GetAllEmployee")); } catch (Exception e) { return(Content(e.Message)); } }
public async Task <IActionResult> ICitizenSignUp([FromForm] SignUp _input) { if (ModelState.IsValid) { bool status = false; var value = HttpContext.Session.GetString(SessionToken); if (string.IsNullOrEmpty(value)) { string token = await getToken(); HttpContext.Session.SetString(SessionToken, token); value = HttpContext.Session.GetString(SessionToken); } SignUpHelper helper = new SignUpHelper(); User _in = await helper.GetCitizenUserInput(_input); User _out = await _login.AddUserDetails(value, _in); if (_out != null) { status = await _login.VendorMail(value, _in); ModelState.AddModelError("successMsg", "Welcome " + _in.Team.TeamName + "!! . Thanks for signing up for iWAY! We're excited to have you onboard."); } } return(View()); }
public ActionResult AddVolunteerDoctor(SignUpViewModel signUpViewModel) { try { var user = new User(); var volunteerDoctor = new VolunteerDoctor(); var signuphelper = new SignUpHelper(); user = signuphelper.GetUserobj(signUpViewModel); var result = _userService.Save(user); var userid = _userService.GetLastId(signUpViewModel.Email); signUpViewModel.UserId = userid.Data; volunteerDoctor = signuphelper.GetVolunteerDoctorobj(signUpViewModel); var result2 = _volunteerDoctorService.Save(volunteerDoctor); if (result.HasError) { ViewBag.Message = result.Message; return(Content(result.Message)); } if (result2.HasError) { ViewBag.Message = result2.Message; return(Content(result2.Message)); } return(RedirectToAction("GetAllVolunteerDoctor")); } catch (Exception e) { return(Content(e.Message)); } }
private void SignUpBtn_Click(object sender, RoutedEventArgs e) { if (SignUpHelper.PasswordValidation(PasswordSignUpBox.Password, Password2SignUpBox.Password)) { MessageDialog msg = new MessageDialog("You have been signed up! Log in with your account."); msg.ShowAsync(); } }
public ActionResult Index() { SignUpHelper sign = new SignUpHelper(); try { var data = sign.ListUser(); } catch (Exception ex) { } return(View()); }
public async Task <IActionResult> CorporateSignUp([FromForm] SignUp _input) { if (ModelState.IsValid) { bool status = false; var value = HttpContext.Session.GetString(SessionToken); if (string.IsNullOrEmpty(value)) { string token = await getToken(); HttpContext.Session.SetString(SessionToken, token); value = HttpContext.Session.GetString(SessionToken); } SignUpHelper helper = new SignUpHelper(); User _in = await helper.GetUserInput(_input); User _out = await _login.AddUserDetails(value, _in); if (_out != null) { status = await _login.Mail(value, _in); var claims = new[] { new Claim(ClaimTypes.UserData, _out.UserId.ToString()), new Claim(ClaimTypes.Role, _out.LookUpUserType.UserType), new Claim(ClaimTypes.PrimarySid, _out.LookUpUserTypeId.ToString()) }; var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); var tempData = _out; await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity)); HttpContext.Session.SetInt32(SessionUser, (int)_out.UserId); HttpContext.Session.SetInt32(SessionUserType, (int)_out.LookUpUserTypeId); //ModelState.AddModelError("successMsg", "Welcome " + _in.Team.TeamName + "!! . Thanks for signing up for iWAY! We're excited to have you onboard."); return(RedirectToAction("CorporateIndex", "Dashboard")); } } return(View()); }
static void Main(string[] args) { //Create a few Data Model Students StudentModel studentModel1 = new StudentModel { Id = 1, FirstName = "test", LastName = "student" }; StudentModel studentModel2 = new StudentModel { Id = 2, FirstName = "test", LastName = "student2" }; StudentModel studentModel3 = new StudentModel { Id = 3, FirstName = "test", LastName = "student3" }; //Add to DB Database.CreateStudent(studentModel1); Database.CreateStudent(studentModel2); Database.CreateStudent(studentModel3); //Get Object Model Students Student student1 = new Student(1); Student student2 = new Student(2); Student student3 = new Student(3); //Create some dance lessons LessonModel dance1 = new LessonModel { LessonType = (int)LessonType.Dance, id = 1, DateOfLesson = new DateTime(2019, 03, 04), LengthInHours = 1, RegisterTaken = false }; LessonModel dance2 = new LessonModel { LessonType = (int)LessonType.Dance, id = 2, DateOfLesson = new DateTime(2019, 03, 11), LengthInHours = 1, RegisterTaken = false }; LessonModel dance3 = new LessonModel { LessonType = (int)LessonType.Dance, id = 3, DateOfLesson = new DateTime(2019, 03, 18), LengthInHours = 1, RegisterTaken = false }; //Create some acting lessons LessonModel acting1 = new LessonModel { LessonType = (int)LessonType.Acting, id = 4, DateOfLesson = new DateTime(2019, 03, 04), LengthInHours = 1, RegisterTaken = false }; LessonModel acting2 = new LessonModel { LessonType = (int)LessonType.Acting, id = 5, DateOfLesson = new DateTime(2019, 03, 11), LengthInHours = 1, RegisterTaken = false }; LessonModel acting3 = new LessonModel { LessonType = (int)LessonType.Acting, id = 6, DateOfLesson = new DateTime(2019, 04, 18), LengthInHours = 1, RegisterTaken = false }; //Create some singing lessons LessonModel singing1 = new LessonModel { LessonType = (int)LessonType.Singing, id = 7, DateOfLesson = new DateTime(2019, 04, 18), LengthInHours = 1, RegisterTaken = false }; LessonModel singing2 = new LessonModel { LessonType = (int)LessonType.Singing, id = 8, DateOfLesson = new DateTime(2019, 04, 25), LengthInHours = 1, RegisterTaken = false }; //Add Lessons to Database Database.CreateLesson(dance1); Database.CreateLesson(dance2); Database.CreateLesson(dance3); Database.CreateLesson(acting1); Database.CreateLesson(acting2); Database.CreateLesson(acting3); Database.CreateLesson(singing1); Database.CreateLesson(singing2); //Sign up students to various lessons SignUpHelper signupHelper = new SignUpHelper(); signupHelper.SignUpToLesson(student1.id, LessonType.Dance); signupHelper.SignUpToLesson(student1.id, LessonType.Acting); signupHelper.SignUpToLesson(student2.id, LessonType.Dance); signupHelper.SignUpToLesson(student3.id, LessonType.Acting); signupHelper.SignUpToLesson(student3.id, LessonType.Singing); //Take First Lesson (id == 1, which is a dance lesson) Lesson lesson1 = new Lesson(1); //all who have signed up are attending this lesson. So no absence will be recorded List <int> lesson1StudentsAttending = new List <int> { 1, 2 }; lesson1.TakeRegister(lesson1StudentsAttending); //try to take register again and you can't lesson1.TakeRegister(lesson1StudentsAttending); //Take First Lesson (id == 2, which is a dance lesson) Lesson lesson2 = new Lesson(2); //one student is missing now List <int> lesson2StudentsAttending = new List <int> { 1 }; lesson2.TakeRegister(lesson2StudentsAttending); //Get Absence AbsenceHelper absencehelper = new AbsenceHelper(); var student2lesson2absence = absencehelper.GetAbsenceIdForStudentAndLesson(2, 2); Console.ReadLine(); }