Esempio n. 1
0
        public async Task <IActionResult> Register(UserSignUpViewModel model)
        {
            if (ModelState.IsValid)
            {
                User user = new User()
                {
                    UserName = model.UserName,
                    Email    = model.Email,
                    Name     = model.Name,
                    SurName  = model.SurName
                };

                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var addRoleResult = await _userManager.AddToRoleAsync(user, "Member");

                    if (addRoleResult.Succeeded)
                    {
                        return(RedirectToAction("Login"));
                    }
                    foreach (var item in addRoleResult.Errors)
                    {
                        ModelState.AddModelError("", item.Description);
                    }
                }
                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError("", item.Description);
                }
            }
            return(View(model));
        }
Esempio n. 2
0
        public HttpResponseMessage AddUser(UserSignUpViewModel userParam)
        {
            UserManager    userManager    = new UserManager();
            HistoryManager historyManager = new HistoryManager();

            try
            {
                var user = new User();
                user.UserName   = userParam.UserName;
                user.Password   = userParam.Password;
                user.Email      = userParam.Email;
                user.FirstName  = userParam.FirstName;
                user.MiddleName = userParam.MiddleName;
                user.LastName   = userParam.LastName;

                userManager.Create(user);
                var dbUser = userManager.FindUserEmail(user.Email);
                historyManager.AddHistory(new History(dbUser)
                {
                    Activity    = Activities.Joined,
                    Description = Helper.GenerateActivityDescription(dbUser, Activities.Joined)
                });
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, user);
                return(response);
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Esempio n. 3
0
        public void GivenUserNotAlreadyInDb_WhenDeleteAccountCalled_ReturnTrue()
        {
            using (var scope = Container.BeginLifetimeScope())
            {
                // Arrange
                User user = _mockData.FakeUser2;
                UserSignUpViewModel signUpViewModel = new UserSignUpViewModel()
                {
                    FirstName = user.FirstName,
                    LastName  = user.LastName,
                    City      = user.City,
                    Email     = user.Email,
                    Password  = user.Password
                };

                _profilesService = scope.Resolve <ProfileService>();
                _signUpService   = scope.Resolve <SignUpService>();


                // Act
                var result = _profilesService.DeleteUserAccount(user);

                // Assert
                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.InstanceOf <bool>());
                Assert.That(result, Is.EqualTo(false));
            }
        }
Esempio n. 4
0
        public async Task <IActionResult> KayitOl(UserSignUpViewModel model)
        {
            if (ModelState.IsValid)
            {
                AppUser user = new AppUser
                {
                    Email    = model.Email,
                    Name     = model.Name,
                    Surname  = model.Surname,
                    UserName = model.Username,
                    Gender   = model.Gender
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }

                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError("", error.Description);
                }
            }
            return(View(model));
        }
Esempio n. 5
0
        public IActionResult SignUp(UserSignUpViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (userService.IsUsernameUnique(model.Username))
                {
                    User user = new User
                    {
                        Name         = model.Name,
                        DepartmentId = model.DepartmentId > 0 ? model.DepartmentId : null,
                        Password     = model.Password,
                        Surname      = model.Surname,
                        Username     = model.Username
                    };
                    userService.Add(user);

                    ViewBag.SuccessMessage = "Kullanıcınız başarılı bir şekilde kaydedildi";
                    return(View());
                }
                else
                {
                    ModelState.AddModelError("", "Bu isimde bir kullanıcı adı zaten var.");
                }
            }
            ViewBag.Departments = new SelectList(departmentService.GetAll(), "Id", "Name");
            return(View(model));
        }
Esempio n. 6
0
        public async Task <ActionResult <IResult> > CreateEmployee([FromBody] UserSignUpViewModel employeeSignUpViewModel)
        {
            _logger.LogInformation("Creating Employee");
            var result = await _employeeService.CreateEmployee(employeeSignUpViewModel);

            return(StatusCode((int)result.StatusCode, result));
        }
Esempio n. 7
0
        public async Task <IActionResult> SignUp(UserSignUpViewModel viewModel)
        {
            if (User.Identity.IsAuthenticated)
            {
                return(RedirectToActionPermanent("Index", "TopicList"));
            }

            if (!TryValidateModel(viewModel, nameof(UserSignUpViewModel)))
            {
                _logger.LogError($"Validation errors for sign up of user with username '{viewModel.Username}': " +
                                 $"{ModelState.Values.SelectMany(x => x.Errors).Select(e => e.ErrorMessage)}");
                return(View());
            }

            string username = viewModel.Username;
            string email    = viewModel.Email;
            string password = viewModel.Password;

            IEnumerable <String>?errors = await _userService.TrySignUpUserAsync(username, password, email);

            if (errors == null)
            {
                return(RedirectToActionPermanent("SentConfirmationEmail"));
            }

            ViewData["signUpErrors"] = errors;
            return(View());
        }
Esempio n. 8
0
        public ActionResult SigningUp(UserSignUpViewModel userSignUpDetails)
        {
            ValidationResult results = _validator.Validate(userSignUpDetails);

            if (results.IsValid)  //  valid signup, update DB and redirect to profile page
            {
                // add new user to db
                _signUpService.AddUser(userSignUpDetails);

                // retrieve newly added user's details from db
                User userProfile = _signUpService.GetUserDetails(userSignUpDetails);
                Session["userId"] = userProfile.UserId;

                return(RedirectToAction("MyProfile", "Profiles"));
            }
            else
            {
                foreach (ValidationFailure failure in results.Errors)
                {
                    ModelState.AddModelError(failure.PropertyName, failure.ErrorMessage);
                }

                ViewBag.Message = "Error in SignUp Occured";
                return(View(userSignUpDetails));
            }
        }
Esempio n. 9
0
        public async Task <IActionResult> Register(UserSignUpViewModel model)
        {
            string phoneNumber = new String(model.PhoneNumber.Where(Char.IsDigit).ToArray());

            if (ModelState.IsValid)
            {
                AppUser appUser = new AppUser
                {
                    Name        = model.Name,
                    SurName     = model.SurName,
                    Email       = model.Email,
                    UserName    = model.UserName,
                    PhoneNumber = phoneNumber
                };

                var result = await _userManager.CreateAsync(appUser, model.Password);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                //foreach (var error in result.Errors)
                //{
                //    ModelState.AddModelError("", error.Description);
                //}
            }

            return(View(model));
        }
        public async Task <IActionResult> KayitOl(UserSignUpViewModel model)
        {
            //her zaman modelstate'in valid olup olmadıgını kontrol edicez.
            //asp.net core identity mimarisi komple asenkronik metotlarla calısır.
            if (ModelState.IsValid)
            {
                AppUser user = new AppUser
                {
                    Email    = model.Email,
                    Name     = model.Name,
                    SurName  = model.SurName,
                    UserName = model.UserName
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    // işlem başarılıysa index sayfasına gönderdik yani girisyap ekranı.
                    return(RedirectToAction("Index"));
                }

                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError("", error.Description);
                }
            }
            return(View(model));
        }
        public async Task <IActionResult> KayitOl(UserSignUpViewModel model)
        {
            if (ModelState.IsValid)
            {
                var userName = await _userManager.FindByNameAsync(model.UserName);

                if (userName == null)
                {
                    AppUser user = new AppUser()
                    {
                        UserName = model.UserName,
                        Name     = model.Name,
                        Surname  = model.Surname,
                        Email    = model.Email
                    };

                    var userCreate = await _userManager.CreateAsync(user, model.Password);

                    if (userCreate.Succeeded)
                    {
                        var role = await _userManager.AddToRoleAsync(user, "Ekip");

                        if (role.Succeeded)
                        {
                            return(RedirectToAction("Index", "Home"));
                        }
                    }
                }
                ModelState.AddModelError("", "Bu Ekip Adı Kullanılıyor.");
            }

            return(View("KayitOl", model));
        }
Esempio n. 12
0
 public void TestSetup()
 {
     _fakeEmailValidator         = Substitute.For <IValidator <string> >();
     _fakePasswordValidator      = Substitute.For <IValidator <SecureString> >();
     _fakePasswordMatchValidator = Substitute.For <IValidator <List <SecureString> > >();
     _fakeQueryDatabase          = Substitute.For <IQueryDatabase>();
     _fakeApplication            = Substitute.For <IApplication>();
     _uut = new UserSignUpViewModel(_fakeEmailValidator, _fakePasswordValidator, _fakePasswordMatchValidator, _fakeQueryDatabase, _fakeApplication);
 }
 public void GivetBrugerOnskerAtOpretteEnProfil()
 {
     _fakeEmailValidator         = Substitute.For <IValidator <string> >();
     _fakePasswordValidator      = Substitute.For <IValidator <SecureString> >();
     _fakePasswordMatchValidator = Substitute.For <IValidator <List <SecureString> > >();
     _fakeQueryDatabase          = Substitute.For <IQueryDatabase>();
     _fakeApplication            = Substitute.For <IApplication>();
     _uut = new UserSignUpViewModel(_fakeEmailValidator, _fakePasswordValidator,
                                    _fakePasswordMatchValidator, _fakeQueryDatabase, _fakeApplication);
 }
Esempio n. 14
0
        public User GetUserDetails(UserSignUpViewModel userSignUpDetails)
        {
            String passwordEntered = userSignUpDetails.Password;
            String emailEntered    = userSignUpDetails.Email;

            var allUserDetails = from users in _userRepository.GetAll() select users;
            var userProfile    =
                (allUserDetails.Where(u => u.Password.Equals(passwordEntered) && u.Email.Equals(emailEntered))).FirstOrDefault();

            return(userProfile);
        }
Esempio n. 15
0
        public void AddUserAccount(UserSignUpViewModel user)
        {
            try
            {
                using (var context = _contextFactory.UserContextInstance())
                {
                    SYSUser SU = new SYSUser();
                    SU.LoginName             = user.LoginName;
                    SU.PasswordEncryptedText = user.Password;
                    SU.CreatedUserID         = user.SYSUserID > 0 ? user.SYSUserID : 1;
                    SU.ModifiedUserID        = user.SYSUserID > 0 ? user.SYSUserID : 1;
                    SU.CreatedDateTime       = DateTime.Now;
                    SU.ModifiedDateTime      = DateTime.Now;
                    context.SYSUser.Add(SU);

                    SYSUserProfile SUP = new SYSUserProfile();
                    SUP.SYSUserID        = SU.SYSUserID;
                    SUP.FirstName        = user.FirstName;
                    SUP.LastName         = user.LastName;
                    SUP.Gender           = user.Gender;
                    SUP.CreatedUserID    = user.SYSUserID > 0 ? user.SYSUserID : 1;
                    SUP.ModifiedUserID   = user.SYSUserID > 0 ? user.SYSUserID : 1;
                    SUP.CreatedDateTime  = DateTime.Now;
                    SUP.ModifiedDateTime = DateTime.Now;
                    context.SYSUserProfile.Add(SUP);

                    if (user.LOOKUPRoleID > 0)
                    {
                        SYSUserRole SUR = new SYSUserRole();
                        SUR.LOOKUPRoleID     = user.LOOKUPRoleID;
                        SUR.SYSUserID        = user.SYSUserID;
                        SUR.IsActive         = true;
                        SUR.CreatedUserID    = user.SYSUserID > 0 ? user.SYSUserID : 1;
                        SUR.ModifiedUserID   = user.SYSUserID > 0 ? user.SYSUserID : 1;
                        SUR.CreatedDateTime  = DateTime.Now;
                        SUR.ModifiedDateTime = DateTime.Now;

                        context.SYSUserRole.Add(SUR);
                    }

                    context.DbContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 16
0
        public IActionResult SignUp(UserSignUpViewModel model)
        {
            if (ModelState.IsValid)
            {
                User user = new User {
                    Email    = model.Email,
                    Name     = model.Name,
                    Password = model.Password,
                    Surname  = model.Surname,
                    UserName = model.UserName
                };

                userService.SignUp(user);
            }
            return(View());
        }
Esempio n. 17
0
        public IActionResult SignUp([FromBody] UserSignUpViewModel createBody)
        {
            UserCreateViewModel user = new UserCreateViewModel
            {
                LoginName   = createBody.LoginName,
                DisplayName = createBody.DisplayName ?? createBody.LoginName,
                IsLocked    = CommonEnum.IsLocked.UnLocked,
                Status      = UserStatus.Normal,
                UserType    = UserType.GeneralUser,
                IsDeleted   = CommonEnum.IsDeleted.No,
            };
            string passwordMD5 = createBody.PasswordMD5;

            user.Password = $"{user.LoginName}${PasswordCalculator.SaltPassword(user.LoginName, passwordMD5)}";

            return(Create(user));
        }
Esempio n. 18
0
        public ActionResult SignUp(UserSignUpViewModel USV)
        {
            if (ModelState.IsValid)
            {
                if (!_userManager.IsLoginNameExist(USV.LoginName))
                {
                    _userManager.AddUserAccount(USV);
                    FormsAuthentication.SetAuthCookie(USV.FirstName, false);

                    return(RedirectToAction("Welcome", "Home"));
                }
                else
                {
                    ModelState.AddModelError("", "Login Name already taken.");
                }
            }
            return(View());
        }
Esempio n. 19
0
        public void GivenInvalidSignUpDetails_WhenSigningUpCalled_RedirectToProfile()
        {
            using (var scope = Container.BeginLifetimeScope())
            {
                _signUpController = scope.Resolve <SignUpController>();
                _profileService   = scope.Resolve <ProfileService>();

                var userDetails = new UserSignUpViewModel();

                // Act
                var result = _signUpController.SigningUp(userDetails) as ViewResult;

                // Assert
                Assert.IsNotNull(result);
                Assert.IsNotNull(result.Model);
                Assert.IsInstanceOf <UserSignUpViewModel>(result.Model);
                Assert.That(result.ViewBag.Message, Is.EqualTo("Error in SignUp Occured"));
            }
        }
Esempio n. 20
0
        public bool AddUser(UserSignUpViewModel userDetails)
        {
            DateTime Dob;

            DateTime.TryParse(userDetails.DOB, out Dob);

            var user = new User()
            {
                FirstName = userDetails.FirstName,
                LastName  = userDetails.LastName,
                City      = userDetails.City,
                Country   = userDetails.Country,
                DOB       = Dob,
                Email     = userDetails.Email,
                Password  = userDetails.Password
            };

            bool result = _userRepository.Create(user);

            return(result);
        }
Esempio n. 21
0
        public void GivenValidSignUpDetails_WhenSigningUpCalled_RedirectToProfile()
        {
            using (var scope = Container.BeginLifetimeScope())
            {
                _signUpController = scope.Resolve <SignUpController>();
                _profileService   = scope.Resolve <ProfileService>();

                var userDetails = new UserSignUpViewModel();

                userDetails.FirstName       = "Bill";
                userDetails.LastName        = "Murray";
                userDetails.City            = "Tokyo";
                userDetails.Country         = "Japan";
                userDetails.Email           = "*****@*****.**";
                userDetails.Password        = "******";
                userDetails.ConfirmPassword = userDetails.Password;
                userDetails.DOB             = "1990-10-10 00:00:00.000";

                var fakeHttpContext = A.Fake <HttpContextBase>();
                var session         = A.Fake <HttpSessionStateBase>();
                session["userId"] = 7;
                A.CallTo(() => fakeHttpContext.Session).Returns(session);
                ControllerContext context = new ControllerContext(new RequestContext(fakeHttpContext, new RouteData()),
                                                                  _signUpController);

                _signUpController.ControllerContext = context;

                // Act
                var result = _signUpController.SigningUp(userDetails) as RedirectToRouteResult;

                // Assert
                Assert.IsNotNull(result);
                var values = result.RouteValues.Values;

                Assert.IsNotNull(values);
                Assert.IsTrue(values.Contains("Profiles"));
                Assert.IsTrue(values.Contains("MyProfile"));
            }
        }
Esempio n. 22
0
        //public ActionResult UserSignUp(User user, Student student)
        public ActionResult UserSignUp(UserSignUpViewModel newUser)
        {
            User    user    = new User();
            Student student = new Student();

            user.UserTypeId           = 3;
            user.UserName             = newUser.UserName;
            user.Password             = newUser.Password;
            user.UserFirstName        = newUser.UserFirstName;
            user.UserLastName         = newUser.UserLastName;
            user.UserMiddleName       = newUser.UserMiddleName;
            student.Gender            = newUser.Gender;
            student.Age               = newUser.Age;
            student.School            = newUser.School;
            student.Grade             = newUser.Grade;
            student.ParentFirstName   = newUser.ParentFirstName;
            student.ParentMiddleName  = newUser.ParentMiddleName;
            student.ParentLastName    = newUser.ParentLastName;
            student.ParentEmail       = newUser.ParentEmail;
            student.ParentPhoneNumber = newUser.ParentPhoneNumber;
            student.Street            = newUser.Street;
            student.City              = newUser.City;
            student.State             = newUser.State;
            student.Zip               = newUser.Zip;
            student.TeacherTitle      = newUser.TeacherTitle;
            student.TeacherFirstName  = newUser.TeacherFirstName;
            student.TeacherMiddleName = newUser.TeacherMiddleName;
            student.TeacherLastName   = newUser.TeacherLastName;
            student.StudentSignature  = newUser.StudentSignature;
            student.ParentSignature   = newUser.ParentSignature;
            dbc.Users.Add(user);
            student.Id = user.Id;
            dbc.Students.Add(student);
            dbc.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
        public async Task <IHttpActionResult> SignUp(UserSignUpViewModel userSignUp)
        {
            if (ModelState.IsValid)
            {
                User user = null;

                if (!string.IsNullOrEmpty(userSignUp.PhoneNumber))
                {
                    user = await db.Users.OrderByDescending(v => v.CreatedAt).FirstOrDefaultAsync(q => q.PhoneNumber == userSignUp.PhoneNumber);
                }
                else if (!string.IsNullOrEmpty(userSignUp.Email))
                {
                    user = await db.Users.OrderByDescending(v => v.CreatedAt).FirstOrDefaultAsync(q => q.Email == userSignUp.Email);
                }
                else
                {
                    return(BadRequest());
                }

                Session session     = null;
                var     randomNonce = RandomHelper.RandomInt(10000, 99999);

                if (user == null || user.State == UserState.DELETED) //New User
                {
                    user = new User()
                    {
                        FirstName   = userSignUp.FirstName,
                        LastName    = userSignUp.LastName,
                        PhoneNumber = userSignUp.PhoneNumber,
                        Email       = userSignUp.Email,
                        Password    = HasherHelper.sha256_hash(userSignUp.Password),
                        CreatedAt   = DateTime.Now,
                        UpdatedAt   = DateTime.Now,
                        State       = UserState.PENDING
                    };

                    db.Users.Add(user);

                    session = new Session()
                    {
                        Nonce           = randomNonce,
                        State           = SessionState.PENDING,
                        InitMoment      = DateTime.Now,
                        SessionKey      = RandomHelper.RandomString(32),
                        FCMToken        = userSignUp.FCMToken,
                        SessionPlatform = (SessionPlatform)userSignUp.SessionPlatform,
                        UniqueCode      = userSignUp.UniqueCode,
                        User            = user
                    };

                    db.Sessions.Add(session);
                    await db.SaveChangesAsync();
                }
                else
                {
                    if (user.State == UserState.PENDING) //multiple requests
                    {
                        // We abolish the old sessions first, then we create new sessions
                        db.Sessions
                        .Where(q => q.UniqueCode == userSignUp.UniqueCode)
                        .Where(q => q.State == SessionState.PENDING)
                        .ToList()
                        .ForEach(q => q.State = SessionState.ABOLISHED);

                        session = new Session()
                        {
                            Nonce           = randomNonce,
                            State           = SessionState.PENDING,
                            InitMoment      = DateTime.Now,
                            SessionKey      = RandomHelper.RandomString(32),
                            FCMToken        = userSignUp.FCMToken,
                            SessionPlatform = (SessionPlatform)userSignUp.SessionPlatform,
                            UniqueCode      = userSignUp.UniqueCode,
                            User            = user
                        };

                        db.Sessions.Add(session);

                        user.FirstName   = userSignUp.FirstName;
                        user.LastName    = userSignUp.LastName;
                        user.PhoneNumber = userSignUp.PhoneNumber;
                        user.Email       = userSignUp.Email;
                        user.Password    = HasherHelper.sha256_hash(userSignUp.Password);
                        user.UpdatedAt   = DateTime.Now;

                        await db.SaveChangesAsync();
                    }
                    else if (user.State == UserState.ACTIVE) //already registered user - use login form
                    {
                        return(Conflict());
                    }
                    else if (user.State == UserState.SUSPENDED) //this phonenumber/email has been suspended
                    {
                        return(StatusCode(HttpStatusCode.Forbidden));
                    }
                }

                var receptorPhone = userSignUp.PhoneNumber;
                var receptorMail  = userSignUp.Email;
                var token         = randomNonce.ToString();

                if (receptorMail != null) //Mail
                {
                    MessageHelper.CodeVerificationEmail(token, receptorMail, MessageHelper.EmailMode.VERIFICATION);
                }

                if (receptorPhone != null)
                {
                    if (MessageHelper.SendSMS_K(token, receptorPhone, MessageHelper.SMSMode.VERIFICATION) != null) //SMS
                    {
                        return(InternalServerError());
                    }
                }

                return(Json(new
                {
                    SessionId = session?.Id ?? -1,
                    SessionKey = session?.SessionKey ?? null
                }));
            }

            return(BadRequest());
        }
Esempio n. 24
0
        /// <summary>
        /// Create Employee
        /// </summary>
        /// <param name="signUpViewModel"></param>
        /// <returns></returns>
        public async Task <IResult> CreateEmployee(UserSignUpViewModel signUpViewModel)
        {
            var result = new Result
            {
                Operation  = Operation.Create,
                Status     = Status.Success,
                StatusCode = HttpStatusCode.OK
            };

            try
            {
                var employeeViewModel = new EmployeeViewModel();
                if (signUpViewModel != null)
                {
                    // email and employee code should be unique
                    var employee1 = await _employeeRepository.GetEmployeeByEmail(signUpViewModel.Email);

                    if (employee1 != null)
                    {
                        result.Status     = Status.Fail;
                        result.StatusCode = HttpStatusCode.NotAcceptable;
                        result.Message    = "Employee Email Id already exists";
                        return(result);
                    }

                    var employee2 = await _employeeRepository.GetEmployeeByEmpCode(signUpViewModel.EmployeeCode);

                    if (employee2 != null)
                    {
                        result.Status     = Status.Fail;
                        result.StatusCode = HttpStatusCode.NotAcceptable;
                        result.Message    = "Employee Code already exists";
                        return(result);
                    }

                    var employeeModel = new Employee();
                    employeeModel.MapFromViewModel(signUpViewModel);
                    employeeModel.Password = BC.HashPassword(signUpViewModel.Password);
                    // by default user registers as employee
                    var role = await _roleRepository.GetRoleByName(EmployeeRolesEnum.Employee.ToString());

                    employeeModel.EmployeeRoles = new List <EmployeeRole> {
                        new EmployeeRole {
                            Employee = employeeModel, Role = role
                        }
                    };
                    employeeModel = await _employeeRepository.CreateEmployee(employeeModel);

                    employeeViewModel.MapFromModel(employeeModel);

                    // uncomment if required
                    //var roles = new List<EmployeeRoleViewModel>();
                    //roles = employeeModel.EmployeeRoles.Select(t =>
                    //{
                    //    var role = new EmployeeRoleViewModel();
                    //    role.Id = t.Id;
                    //    role.RoleId = t.RoleId;
                    //    role.RoleName = t.Role.Name;
                    //    role.EmployeeId = t.EmployeeId;
                    //    return role;
                    //}).ToList();

                    // send email to HR for approval
                    var mailresult = await SendRegisterationRequestEmail(employeeViewModel);

                    result.Message = mailresult.Message;
                    result.Body    = employeeViewModel;
                    return(result);
                }
                result.Status     = Status.Fail;
                result.StatusCode = HttpStatusCode.BadRequest;
                return(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                result.Status  = Status.Error;
                return(result);
            }
        }