public async Task <ActionResult <CommonAPIResponse <bool> > > AddJobRole(JobRoleAddDTO JobRoleAddDTO) { #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <bool>(); #endregion try { #region Validate AddJobRole for nullability before prepaing the response. if (await JobRoleAppService.AddJobRole(JobRoleAddDTO)) { 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 JobRole AppService /// </summary> /// <returns>bool<bool></returns> public async Task<bool> AddJobRole(JobRoleAddDTO jobRoleAddDTO) { #region Declare a return type with initial value. bool isCreated = false; #endregion try { if (jobRoleAddDTO != null) { isCreated = await JobRoleBusinessMapping.AddJobRole(jobRoleAddDTO); } } catch (Exception exception){} return isCreated; }
/// <summary> /// Mapping user Action Actitvity Log /// </summary> /// <param name=></ param > /// <returns>Task<JobRole></returns> public JobRole MappingJobRoleAddDTOToJobRole(JobRoleAddDTO JobRoleAddDTO) { #region Declare a return type with initial value. JobRole JobRole = null; #endregion try { JobRole = new JobRole { JobRoleName = JobRoleAddDTO.JobRoleName, Description = JobRoleAddDTO.Description, CreationDate = DateTime.Now, IsDeleted = (byte)DeleteStatusEnum.NotDeleted }; } catch (Exception exception) { } return(JobRole); }
/// <summary> /// Create User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> AddJobRole(JobRoleAddDTO JobRoleAddDTO) { #region Declare a return type with initial value. bool isJobRoleCreated = default(bool); #endregion try { #region Vars JobRole JobRole = null; #endregion JobRole = JobRoleMapping.MappingJobRoleAddDTOToJobRole(JobRoleAddDTO); if (JobRole != null) { await UnitOfWork.JobRoleRepository.Insert(JobRole); isJobRoleCreated = await UnitOfWork.Commit() > default(int); } } catch (Exception exception) { } return(isJobRoleCreated); }