/// <summary>
 /// Updae Language AppService
 /// </summary>
 /// <returns>bool<bool></returns>
 public async Task <bool> UpdateLanguage(LanguageUpdateDTO languageUpdateDTO)
 {
     #region Declare a return type with initial value.
     bool isUpdated = false;
     #endregion
     try
     {
         if (languageUpdateDTO != null)
         {
             isUpdated = await LanguageBusinessMapping.UpdateLanguage(languageUpdateDTO);
         }
     }
     catch (Exception exception) {}
     return(isUpdated);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Mapping User Activity Log DTO to Action
 /// </summary>
 /// <param name=></param>
 /// <param name=></param>
 /// <returns></returns>
 public Language MappingLanguageupdateDTOToLanguage(Language language, LanguageUpdateDTO LanguageUpdateDTO)
 {
     #region Declare Return Var with Intial Value
     Language Language = language;
     #endregion
     try
     {
         if (LanguageUpdateDTO.LanguageId > default(int))
         {
             Language.LanguageId   = LanguageUpdateDTO.LanguageId;
             Language.LanguageName = LanguageUpdateDTO.LanguageName;
         }
     }
     catch (Exception exception) { }
     return(Language);
 }
        /// <summary>
        /// Update User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> UpdateLanguage(LanguageUpdateDTO LanguageUpdateDTO)
        {
            #region Declare a return type with initial value.
            bool isLanguageUpdated = default(bool);
            #endregion
            try
            {
                if (LanguageUpdateDTO != null)
                {
                    #region Vars
                    Language Language = null;
                    #endregion
                    #region Get Activity By Id
                    Language = await UnitOfWork.LanguageRepository.GetById(LanguageUpdateDTO.LanguageId);

                    #endregion
                    if (Language != null)
                    {
                        #region  Mapping
                        Language = LanguageMapping.MappingLanguageupdateDTOToLanguage(Language, LanguageUpdateDTO);
                        #endregion
                        if (Language != null)
                        {
                            #region  Update Entity
                            UnitOfWork.LanguageRepository.Update(Language);
                            isLanguageUpdated = await UnitOfWork.Commit() > default(int);

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

            try
            {
                #region Validate userUpdateDTO for nullability before prepaing the response.
                if (await LanguageAppService.UpdateLanguage(LanguageUpdateDTO))
                {
                    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);
        }