示例#1
0
        public DTO.ApplicationStore GetApplicationStoreByStore(Guid storeCode, string nameApplication)
        {
            DTO.ApplicationStore result = null;

            var listAppStore = applicationStoreRepository.GetByStore(storeCode);

            if (!listAppStore.IsNull())
            {
                var appStore = listAppStore.FirstOrDefault(x => x.Application.Name.ToLower() == nameApplication);
                if (!appStore.IsNull())
                {
                    result = new DTO.ApplicationStore(appStore, false);
                }
            }

            return(result);
        }
示例#2
0
        public IHttpActionResult SendPasswordEmail(DTO.AccountInput input)
        {
            try
            {
                DTO.ApplicationStore appStore = null;
                Guid?confId = null;
                if (base.IsMainAdmin)
                {
                    appStore = appStoreApp.GetApplicationStoreByStoreTypeMain("Hagrid-UI-Login");
                    if (!appStore.IsNull())
                    {
                        confId = appStore.ConfidentialClient;
                    }
                }
                else
                {
                    confId = base.ClientId;
                }

                if (!confId.HasValue)
                {
                    throw new ArgumentException("Aplicação não encontrada");
                }

                resetPasswordTokenApp.GenerateResetPasswordToken(input.Email, confId.Value);

                return(Ok());
            }
            catch (LockedUpMemberException ex)
            {
                return(BadRequest(new ArgumentException(ex.Message)));
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#3
0
        public DTO.ApplicationStore GetApplicationStoreByStoreTypeMain(string nameApplication)
        {
            DTO.ApplicationStore result = null;

            var apps = applicationRepository.List().FirstOrDefault(x => x.Name.ToLower() == nameApplication.ToLower());

            if (apps != null)
            {
                var listAppStore = applicationStoreRepository.GetByStoreTypeMain(apps.Code.Value);

                if (!listAppStore.IsNull())
                {
                    var appStore = listAppStore.FirstOrDefault(x => x.Application.Name.ToLower() == nameApplication);
                    if (!appStore.IsNull())
                    {
                        return(new DTO.ApplicationStore(appStore, false));
                    }
                }
            }

            return(result);
        }