Exemple #1
0
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            AdvertisementsContext ads = new AdvertisementsContext();
            var ads_list = ads.Advertisements.ToList();

            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var userId = User.Identity.GetUserId();
            var model  = new IndexViewModel
            {
                HasPassword       = HasPassword(),
                PhoneNumber       = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor         = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins            = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };

            return(View(model));
        }
        public ShowAdvertisementViewModel getEditAdvertisementModelForUser(string user_id, string user_name, int advertisement_id)
        {
            this.user_id   = user_id;
            this.user_name = user_name;

            AdvertisementsContext adv_ctx = new AdvertisementsContext();
            CategoryContext       cat_ctx = new CategoryContext();

            advertisement = adv_ctx.Advertisements.Where(a => a.Id.Equals(advertisement_id)).First();
            category      = cat_ctx.Categories.Where(a => a.Id.Equals(advertisement.category)).First().name;

            return(this);
        }
 public AdvertisementsPlugin(AdvertisementsContext adsContext)
 {
     _adsContext = adsContext;
 }
Exemple #4
0
 public AdvertisementsPlugin(AdvertisementsContext adsContext)
 {
     _adsContext = adsContext;
 }