/// <summary> /// Updae CompanyType AppService /// </summary> /// <returns>bool<bool></returns> public async Task <bool> UpdateCompanyType(CompanyTypeUpdateDTO companyTypeUpdateDTO) { #region Declare a return type with initial value. bool isUpdated = false; #endregion try { if (companyTypeUpdateDTO != null) { isUpdated = await CompanyTypeBusinessMapping.UpdateCompanyType(companyTypeUpdateDTO); } } catch (Exception exception) {} return(isUpdated); }
/// <summary> /// Update User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task<bool> UpdateCompanyType(CompanyTypeUpdateDTO CompanyTypeUpdateDTO) { #region Declare a return type with initial value. bool isCompanyTypeUpdated = default(bool); #endregion try { if (CompanyTypeUpdateDTO != null) { #region Vars CompanyType CompanyType = null; #endregion #region Get Activity By Id CompanyType = await UnitOfWork.CompanyTypeRepository.GetById(CompanyTypeUpdateDTO.CompanyTypeId); #endregion if (CompanyType != null) { #region Mapping CompanyType = CompanyTypeMapping.MappingCompanyTypeupdateDTOToCompanyType(CompanyType ,CompanyTypeUpdateDTO); #endregion if (CompanyType != null) { #region Update Entity UnitOfWork.CompanyTypeRepository.Update(CompanyType); isCompanyTypeUpdated = await UnitOfWork.Commit() > default(int); #endregion } } } } catch (Exception exception) { } return isCompanyTypeUpdated; }
public async Task <ActionResult <CommonAPIResponse <bool> > > UpdateCompanyType(CompanyTypeUpdateDTO CompanyTypeUpdateDTO) { #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <bool>(); #endregion try { #region Validate userUpdateDTO for nullability before prepaing the response. if (await CompanyTypeAppService.UpdateCompanyType(CompanyTypeUpdateDTO)) { 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> /// Mapping User Activity Log DTO to Action /// </summary> /// <param name=></param> /// <param name=></param> /// <returns></returns> public CompanyType MappingCompanyTypeupdateDTOToCompanyType(CompanyType companyType, CompanyTypeUpdateDTO CompanyTypeUpdateDTO) { #region Declare Return Var with Intial Value CompanyType CompanyType = companyType; #endregion try { if (CompanyTypeUpdateDTO.CompanyTypeId > default(int)) { CompanyType.CompanyTypeId = CompanyTypeUpdateDTO.CompanyTypeId; CompanyType.CompanyTypeName = CompanyTypeUpdateDTO.CompanyTypeName; } } catch (Exception exception) { } return(CompanyType); }