コード例 #1
0
 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));
     }
 }
コード例 #2
0
 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));
     }
 }