public async Task <ActionResult <CommonAPIResponse <bool> > > AddLanguage(LanguageAddDTO LanguageAddDTO)
        {
            #region Declare return type with initial value.
            JsonResult jsonResult = GetDefaultJsonResult <bool>();
            #endregion

            try
            {
                #region Validate AddLanguage for nullability before prepaing the response.

                if (await LanguageAppService.AddLanguage(LanguageAddDTO))
                {
                    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 Language AppService
 /// </summary>
 /// <returns>bool<bool></returns>
 public async Task <bool> AddLanguage(LanguageAddDTO languageAddDTO)
 {
     #region Declare a return type with initial value.
     bool isCreated = false;
     #endregion
     try
     {
         if (languageAddDTO != null)
         {
             isCreated = await LanguageBusinessMapping.AddLanguage(languageAddDTO);
         }
     }
     catch (Exception exception) {}
     return(isCreated);
 }
Beispiel #3
0
 /// <summary>
 /// Mapping user Action Actitvity Log
 /// </summary>
 /// <param name=></ param >
 /// <returns>Task<Language></returns>
 public Language MappingLanguageAddDTOToLanguage(LanguageAddDTO LanguageAddDTO)
 {
     #region Declare a return type with initial value.
     Language Language = null;
     #endregion
     try
     {
         Language = new Language
         {
             LanguageName = LanguageAddDTO.LanguageName,
             CreationDate = DateTime.Now,
             IsDeleted    = (byte)DeleteStatusEnum.NotDeleted
         };
     }
     catch (Exception exception) { }
     return(Language);
 }
        /// <summary>
        /// Create User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> AddLanguage(LanguageAddDTO LanguageAddDTO)
        {
            #region Declare a return type with initial value.
            bool isLanguageCreated = default(bool);
            #endregion
            try
            {
                #region Vars
                Language Language = null;
                #endregion
                Language = LanguageMapping.MappingLanguageAddDTOToLanguage(LanguageAddDTO);
                if (Language != null)
                {
                    await UnitOfWork.LanguageRepository.Insert(Language);

                    isLanguageCreated = await UnitOfWork.Commit() > default(int);
                }
            }
            catch (Exception exception)
            {
            }
            return(isLanguageCreated);
        }