/// <summary> /// Create User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> AddEmployer(EmployerAddDTO EmployerAddDTO) { #region Declare a return type with initial value. bool isEmployerCreated = default(bool); #endregion try { #region Vars Employer Employer = null; UserPasswordDTO userPasswordDTO = null; #endregion Employer = EmployerMapping.MappingEmployerAddDTOToEmployer(EmployerAddDTO); userPasswordDTO = CreatePasswordHash(EmployerAddDTO.Password); Employer.PasswordHash = userPasswordDTO.PasswordHash; Employer.PasswordSalt = userPasswordDTO.PasswordSalt; if (Employer != null) { await UnitOfWork.EmployerRepository.Insert(Employer); isEmployerCreated = await UnitOfWork.Commit() > default(int); } } catch (Exception exception) { } return(isEmployerCreated); }
public async Task <ActionResult <CommonAPIResponse <bool> > > AddEmployer(EmployerAddDTO EmployerAddDTO) { #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <bool>(); #endregion try { #region Validate AddEmployer for nullability before prepaing the response. if (await EmployerAppService.AddEmployer(EmployerAddDTO)) { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), true, HttpStatusCode.OK); } else { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), false, HttpStatusCode.BadRequest); } #endregion } catch (Exception exception) { } return(jsonResult); }
/// <summary> /// Add Employer AppService /// </summary> /// <returns>bool<bool></returns> public async Task <bool> AddEmployer(EmployerAddDTO employerAddDTO) { #region Declare a return type with initial value. bool isCreated = false; #endregion try { if (employerAddDTO != null) { isCreated = await EmployerBusinessMapping.AddEmployer(employerAddDTO); } } catch (Exception exception) {} return(isCreated); }
/// <summary> /// Mapping user Action Actitvity Log /// </summary> /// <param name=></ param > /// <returns>Task<Employer></returns> public Employer MappingEmployerAddDTOToEmployer(EmployerAddDTO EmployerAddDTO) { #region Declare a return type with initial value. Employer Employer = null; #endregion try { Employer = new Employer { FirstName = EmployerAddDTO.FirstName, LastName = EmployerAddDTO.LastName, BusinessEmail = EmployerAddDTO.BusinessEmail, MobileNumber = EmployerAddDTO.MobileNumber, MobileNumber1 = EmployerAddDTO.MobileNumber1, ReferralId = EmployerAddDTO.ReferralId, Title = EmployerAddDTO.Title, CreationDate = DateTime.Now, IsDeleted = (byte)DeleteStatusEnum.NotDeleted }; } catch (Exception exception) { } return(Employer); }