예제 #1
0
        public ActionResult Create()
        {
            // Copy over the possibly applicable data to the listing so the user doesn't have to type it twice if it's the same as the account info.
            ListingViewModelEdit listing = new ListingViewModelEdit();
            //plamen: instead of copy get available account data and use
            AccountLogic accountLogic = new AccountLogic();
            var accountVM = accountLogic.GetByEmail(User.Identity.Name);

            ClientCardInfoLogic ClientCardInfoLogic = new ClientCardInfoLogic();

            if (accountVM != null)
            {
                var clientCardInfo = ClientCardInfoLogic.GetByClientGuid(accountVM.ClientGuid);
                if (null == clientCardInfo)
                    return RedirectToAction("ClientCardInfo","Account");
                listing = accountVM.FeedListing();
                this.AddListingTypesToListing(listing);
                this.AddTypesOfCareToListing(listing);
                this.AddFacilityPhotoToListing(listing, true);
            }

            listing.SaveButtonText = listing.ActionName = "Create";
            // If logged in, show the form.
            return View(listing);
        }
예제 #2
0
        public ActionResult List()
        {
            var user = Membership.GetUser();
            if (user == null)
            {
                return RedirectToAction("Create", "Account");
            }

            string email = user.UserName;
            AccountLogic accountLogic = new AccountLogic();
            AccountViewModel accountVM = accountLogic.GetByEmail(email);

            if (accountVM != null)
            {
                ListingLogic listingLogic = new ListingLogic();
                IEnumerable<ListingViewModel> listings = listingLogic.GetListingByClientGuid(accountVM.ClientGuid);
                return View(listings);
            }
            else
            {
                return RedirectToAction("Create", "Account");
            }
        }
예제 #3
0
        public ActionResult See()
        {
            AccountLogic accountLogic = new AccountLogic();
            AccountViewModel accountVM = accountLogic.GetByEmail(User.Identity.Name);

            // If an account does not exist, help user create one.
            if (null == accountVM)
            {
                return RedirectToAction("Create", "Account");
            }
            // If it does exist, show it.
            else
            {
                AccountWithListingsViewModel accountWithListings = accountVM.WithListings();
                ListingLogic llogic = new ListingLogic();
                var listings = llogic.GetListingsWithDateModifiedByClientGuid(accountWithListings.ClientGuid);
                accountWithListings.AccountListings = listings.ToList();
                ClientCardInfoLogic ClientCardInfoLogic = new ClientCardInfoLogic();
                var ccinfo= ClientCardInfoLogic.GetByClientGuid(accountWithListings.ClientGuid);

                ClientCardInfoViewModel clientCardInfoVM = new ClientCardInfoViewModel();
                if (ccinfo != null)
                    clientCardInfoVM = DecryptCCinfo(ccinfo);
                accountWithListings.clientCardInfoVM = clientCardInfoVM;

                return View(accountWithListings);
            }
        }
예제 #4
0
        public ViewResult Edit(Guid accountGuid)
        {
            // Get account object from db
            AccountLogic logic = new AccountLogic();
            AccountViewModel account = logic.GetByPK(accountGuid);

            return View(account);
        }
예제 #5
0
        public ActionResult Create()
        {
            // If logged in, show the appropriate view.
            var user = Membership.GetUser();
            if (null == user)
            {
                // If they don't yet have an account, show the create account view.
                //plamen: account shouldn't be created without membership user
                ModelState.AddModelError("accountCreate", "Membership user not created. Repeat the login process.");
                return View();
            }
            else
            {
                // If they have an account, show the edit account view.
                AccountLogic logic = new AccountLogic();
                AccountViewModel account = logic.GetByEmail(user.UserName);
                if (account != null)
                {

                    return RedirectToAction("See");
                }
                else
                {

                    return View();
                }
            }
        }
예제 #6
0
        protected ActionResult ShowCreate()
        {
            if (Request.IsAuthenticated)
            {
                AccountLogic accountLogic = new AccountLogic();
                AccountViewModel accountVM = accountLogic.GetByEmail(User.Identity.Name);
                // If an account does not exist, help user create one.
                if (null == accountVM)
                {
                    return RedirectToAction("Create", "Account");
                }
                else
                {
                    // redirect user to requested url before authentication
                    var redirectUrl = SessionHandler.Current.ReturnUrl;
                    if (!string.IsNullOrEmpty(redirectUrl) && Url.IsLocalUrl(redirectUrl))
                    {
                        return Redirect(redirectUrl);
                    }

                    return RedirectToAction("View", "Account");
                }
            }

            return RedirectToAction("Search", "Search");
        }