Beispiel #1
0
        // GET: Appointments
        public ActionResult Index(string startDateString, string activeDateString, string professionalIdString)
        {
            // If the Pro isn't set up, make them add the info.
            CompanyProfessionalVm companyPro = new CompanyProfessionalVm(_professionalQueries, _companyQueries, User.Identity.GetUserId());

            // We are logged in, but don't have the main info saved.
            // Send them to the profile page.
            if (!companyPro.IsProfessionalValid())
            {
                return(RedirectToAction("Edit", "ProfessionalProfile"));
            }

            // If the Company isn't set up, make them add the info.
            if (!companyPro.IsCompanyInfoValid())
            {
                return(RedirectToAction("Edit", "CompanyProfile"));
            }


            // Get the appointments with a list of employees details this user can access
            CalendarVm calendarVm = new CalendarVm(_companyQueries, User.Identity.GetUserId(), companyPro.GetProfessionalId(), professionalIdString);
            var        startDate  = GetStartDateFromStringParam(startDateString);
            var        activeDate = GetStartDateFromStringParam(activeDateString);

            if (startDate < DateTime.Now)
            {
                startDate = DateTime.Now;
            }
            if (activeDate < startDate)
            {
                activeDate = startDate;
            }

            if (activeDate.Date > startDate.Date.AddDays(3))
            {
                startDate = activeDate.AddDays(-2);
            }

            calendarVm.AvailableDates = CreateAvailableDatesList(startDate);
            calendarVm.ActiveDate     = activeDate;

            return(View(calendarVm));
        }
Beispiel #2
0
        public ActionResult IndexAuth()
        {
            // If the Pro isn't set up, make them add the info.
            CompanyProfessionalVm companyPro = new CompanyProfessionalVm(_professionalQueries, _companyQueries, User.Identity.GetUserId());

            // We are logged in, but don't have the main info saved.
            // Send them to the profile page.
            if (!companyPro.IsProfessionalValid())
            {
                return(RedirectToAction("Edit", "ProfessionalProfile"));
            }

            // If the Company isn't set up, make them add the info.
            if (!companyPro.IsCompanyInfoValid())
            {
                return(RedirectToAction("Edit", "CompanyProfile"));
            }


            return(View(companyPro));
        }