Пример #1
0
 /// <summary>
 /// Updae CompanyUserType AppService
 /// </summary>
 /// <returns>bool<bool></returns>
 public async Task <bool> UpdateCompanyUserType(CompanyUserTypeUpdateDTO companyUserTypeUpdateDTO)
 {
     #region Declare a return type with initial value.
     bool isUpdated = false;
     #endregion
     try
     {
         if (companyUserTypeUpdateDTO != null)
         {
             isUpdated = await CompanyUserTypeBusinessMapping.UpdateCompanyUserType(companyUserTypeUpdateDTO);
         }
     }
     catch (Exception exception) {}
     return(isUpdated);
 }
        /// <summary>
        /// Update User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> UpdateCompanyUserType(CompanyUserTypeUpdateDTO CompanyUserTypeUpdateDTO)
        {
            #region Declare a return type with initial value.
            bool isCompanyUserTypeUpdated = default(bool);
            #endregion
            try
            {
                if (CompanyUserTypeUpdateDTO != null)
                {
                    #region Vars
                    CompanyUserType CompanyUserType = null;
                    #endregion
                    #region Get Activity By Id
                    CompanyUserType = await UnitOfWork.CompanyUserTypeRepository.GetById(CompanyUserTypeUpdateDTO.CompanyUserTypeId);

                    #endregion
                    if (CompanyUserType != null)
                    {
                        #region  Mapping
                        CompanyUserType = CompanyUserTypeMapping.MappingCompanyUserTypeupdateDTOToCompanyUserType(CompanyUserType, CompanyUserTypeUpdateDTO);
                        #endregion
                        if (CompanyUserType != null)
                        {
                            #region  Update Entity
                            UnitOfWork.CompanyUserTypeRepository.Update(CompanyUserType);
                            isCompanyUserTypeUpdated = await UnitOfWork.Commit() > default(int);

                            #endregion
                        }
                    }
                }
            }
            catch (Exception exception)
            {
            }
            return(isCompanyUserTypeUpdated);
        }
        public async Task <ActionResult <CommonAPIResponse <bool> > > UpdateCompanyUserType(CompanyUserTypeUpdateDTO CompanyUserTypeUpdateDTO)
        {
            #region Declare return type with initial value.
            JsonResult jsonResult = GetDefaultJsonResult <bool>();
            #endregion

            try
            {
                #region Validate userUpdateDTO for nullability before prepaing the response.
                if (await CompanyUserTypeAppService.UpdateCompanyUserType(CompanyUserTypeUpdateDTO))
                {
                    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);
        }
Пример #4
0
 /// <summary>
 /// Mapping User Activity Log DTO to Action
 /// </summary>
 /// <param name=></param>
 /// <param name=></param>
 /// <returns></returns>
 public CompanyUserType MappingCompanyUserTypeupdateDTOToCompanyUserType(CompanyUserType companyUserType, CompanyUserTypeUpdateDTO CompanyUserTypeUpdateDTO)
 {
     #region Declare Return Var with Intial Value
     CompanyUserType CompanyUserType = companyUserType;
     #endregion
     try
     {
         if (CompanyUserTypeUpdateDTO.CompanyUserTypeId > default(int))
         {
             CompanyUserType.CompanyUserTypeId   = CompanyUserTypeUpdateDTO.CompanyUserTypeId;
             CompanyUserType.CompanyUserTypeName = CompanyUserTypeUpdateDTO.CompanyUserTypeName;
         }
     }
     catch (Exception exception) { }
     return(CompanyUserType);
 }