/// <summary> /// Updae JobRole AppService /// </summary> /// <returns>bool<bool></returns> public async Task<bool> UpdateJobRole(JobRoleUpdateDTO jobRoleUpdateDTO) { #region Declare a return type with initial value. bool isUpdated = false; #endregion try { if (jobRoleUpdateDTO != null) { isUpdated = await JobRoleBusinessMapping.UpdateJobRole(jobRoleUpdateDTO); } } catch (Exception exception){} return isUpdated; }
/// <summary> /// Mapping User Activity Log DTO to Action /// </summary> /// <param name=></param> /// <param name=></param> /// <returns></returns> public JobRole MappingJobRoleupdateDTOToJobRole(JobRole jobRole, JobRoleUpdateDTO JobRoleUpdateDTO) { #region Declare Return Var with Intial Value JobRole JobRole = jobRole; #endregion try { if (JobRoleUpdateDTO.JobRoleId > default(int)) { JobRole.JobRoleName = JobRoleUpdateDTO.JobRoleName; JobRole.JobRoleId = JobRoleUpdateDTO.JobRoleId; JobRole.Description = JobRoleUpdateDTO.Description; } } catch (Exception exception) { } return(JobRole); }
/// <summary> /// Update User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> UpdateJobRole(JobRoleUpdateDTO JobRoleUpdateDTO) { #region Declare a return type with initial value. bool isJobRoleUpdated = default(bool); #endregion try { if (JobRoleUpdateDTO != null) { #region Vars JobRole JobRole = null; #endregion #region Get Activity By Id JobRole = await UnitOfWork.JobRoleRepository.GetById(JobRoleUpdateDTO.JobRoleId); #endregion if (JobRole != null) { #region Mapping JobRole = JobRoleMapping.MappingJobRoleupdateDTOToJobRole(JobRole, JobRoleUpdateDTO); #endregion if (JobRole != null) { #region Update Entity UnitOfWork.JobRoleRepository.Update(JobRole); isJobRoleUpdated = await UnitOfWork.Commit() > default(int); #endregion } } } } catch (Exception exception) { } return(isJobRoleUpdated); }
public async Task <ActionResult <CommonAPIResponse <bool> > > UpdateJobRole(JobRoleUpdateDTO JobRoleUpdateDTO) { #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <bool>(); #endregion try { #region Validate userUpdateDTO for nullability before prepaing the response. if (await JobRoleAppService.UpdateJobRole(JobRoleUpdateDTO)) { 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); }