public async Task <ActionResult <EmployeeInfo> > PostEmployeeInfo(GetEmployeeForEditOutput getEmployeeForEditOutput) { getEmployeeForEditOutput.Username = getEmployeeForEditOutput.Username.ToLower(); getEmployeeForEditOutput.Email = getEmployeeForEditOutput.Email.ToLower(); if (!await _employeeInfoRepository.IsEmployeeUserNameExists(getEmployeeForEditOutput.Username)) { return(BadRequest("Username is Already Exist")); } if (!await _employeeInfoRepository.IsEmployeeEmailExists(getEmployeeForEditOutput.Email)) { return(BadRequest("Email is Already Exist")); } var userLoginToCreate = new UserLogin { Username = getEmployeeForEditOutput.Username, UserType = "E", CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now }; var createdUserLogin = await _employeeInfoRepository.CreateUserLogin(userLoginToCreate, getEmployeeForEditOutput.Password); EmployeeInfo employee = null; if (createdUserLogin.Id > 0) { employee = await _employeeInfoRepository.PostEmployeeInfo(getEmployeeForEditOutput, createdUserLogin.Id); } return(employee); }