Пример #1
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;
            }
        }
Пример #2
0
        public async Task <IActionResult> IndexAsync(ApplicationConfiguration app)
        {
            try
            {
                string BannerImageURL = app.AppBanner.FileName != null ? await BlobStorageHelper.GetImageUrl(await GetFilePath(app.AppBanner)) : null;

                string LogoImageURl = app.AppLogo != null ? await BlobStorageHelper.GetImageUrl(await GetFilePath(app.AppLogo)) : null;

                foreach (var item in app.LoBapplicationDetails)
                {
                    item.TeamsAppId = Guid.Parse(_config[item.AppName]);
                    //item.AppName = i.AppName;
                    item.AppDescription = item.AppName;
                    item.AppLogoUrl     = await BlobStorageHelper.GetImageUrl(await GetFilePath(item.AppLogo));
                }
                foreach (var item in app.NewsFeed)
                {
                    item.NewsUrl = item.NewsUrl;
                }
                string userMailID = User.Identity.Name;
                string userName   = userMailID.Substring(0, (userMailID.IndexOf('@')));
                GetAppConfiguration(userMailID, _context);

                var apConfig = new ApplicationConfiguration
                {
                    UserName              = userName,
                    UserEmailId           = userMailID,
                    AppDisplayName        = app.AppDisplayName,
                    AppDescription        = app.AppDescription,
                    AppStatus             = true,
                    AppBannerUrl          = BannerImageURL,
                    AppLogoUrl            = LogoImageURl,
                    FontColor             = app.FontColor,
                    FontFamily            = app.FontFamily,
                    IsWeatherApp          = false,
                    IsNewsFeedEnabled     = false,
                    LoBapplicationDetails = app.LoBapplicationDetails,
                    NewsFeed              = app.NewsFeed
                };

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

                ViewBag.Message = string.Format("Your data is recorded !");

                var model = new ApplicationConfiguration();
                model.LoBapplicationDetails = new System.Collections.Generic.List <LoBapplicationDetails>()
                {
                    new LoBapplicationDetails()
                    {
                        AppName = "Payslips"
                    },
                    new LoBapplicationDetails()
                    {
                        AppName = "Forms"
                    },
                    new LoBapplicationDetails()
                    {
                        AppName = "Leads"
                    },
                    new LoBapplicationDetails()
                    {
                        AppName = "Career"
                    },
                    new LoBapplicationDetails()
                    {
                        AppName = "Discounts"
                    },
                    new LoBapplicationDetails()
                    {
                        AppName = "Kudos"
                    },
                    new LoBapplicationDetails()
                    {
                        AppName = "Benefits"
                    }
                };
                return(View(model));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }