Exemplo n.º 1
0
        public static void GetAppConfiguration(string emailId, ApplicationConfigurationContext context)
        {
            var appConfig = context.AppConfiguration.Where(a => a.UserEmailID == emailId && a.AppStatus == "Active").First();

            if (appConfig != null)
            {
                appConfig.AppStatus            = "Inactive";
                context.Entry(appConfig).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> IndexAsync(ApplicationsConfiguration app)
        {
            try
            {
                string BannerImageURL = await BlobStorageHelper.GetImageUrl(app.AppBannerURL);

                string LogoImageURl = await BlobStorageHelper.GetImageUrl(app.LogoURL);

                string PayslipsImageURL = await BlobStorageHelper.GetImageUrl(app.PayslipsLogoURL);

                string FormsImageURL = await BlobStorageHelper.GetImageUrl(app.FormsLogoURL);

                string LeadsImageURL = await BlobStorageHelper.GetImageUrl(app.LeadsLogoURL);

                string CareerImageURL = await BlobStorageHelper.GetImageUrl(app.CareerLogoURL);

                string DiscountsImageURL = await BlobStorageHelper.GetImageUrl(app.DiscountsLogoURL);

                string KudosImageURL = await BlobStorageHelper.GetImageUrl(app.KudosLogoURL);

                string userMailID = User.Identity.Name;
                string userName   = userMailID.Substring(0, (userMailID.IndexOf('@')));
                GetAppConfiguration(userMailID, _context);
                var apConfig = new ApplicationsConfiguration
                {
                    UserName         = userName,
                    UserEmailID      = userMailID,
                    AppDisplayName   = app.AppDisplayName,
                    AppDescription   = app.AppDescription,
                    AppStatus        = "Active",
                    AppBannerURL     = BannerImageURL,
                    LogoURL          = LogoImageURl,
                    Theme            = app.Theme,
                    FontColor        = app.FontColor,
                    FontFamily       = app.FontFamily,
                    WeatherApp       = Guid.Parse(weatherAppID),
                    Payslips         = Guid.Parse(payslipAppID),
                    PayslipsLogoURL  = PayslipsImageURL,
                    Forms            = Guid.Parse(formsAppID),
                    FormsLogoURL     = FormsImageURL,
                    Leads            = Guid.Parse(careerAppID),
                    LeadsLogoURL     = LeadsImageURL,
                    Career           = Guid.Parse(discountsAppID),
                    CareerLogoURL    = CareerImageURL,
                    Discounts        = Guid.Parse(discountsAppID),
                    DiscountsLogoURL = DiscountsImageURL,
                    Kudos            = Guid.Parse(discountsAppID),
                    KudosLogoURL     = KudosImageURL,
                    NewsFeedOne      = app.NewsFeedOne,
                    NewsFeedTwo      = app.NewsFeedTwo,
                    NewsFeedThree    = app.NewsFeedThree,
                    NewsFeedFour     = app.NewsFeedFour,
                    NewsFeedFive     = app.NewsFeedFive
                };

                _context.AppConfiguration.Add(apConfig);
                _context.SaveChanges();

                return(View());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }