Пример #1
0
        // GET: Loads and displays the site's Medical center page
        public ActionResult Index()
        {
            // Retrieves the Medical center page using the 'GetMedicalCenter' method from the page type's generated provider
            MedicalCenter medicalCenterNode =
                MedicalCenterProvider.GetMedicalCenter("/Medical-Center", "en-us", SiteContext.CurrentSiteName)
                .Columns("DocumentName", "MedicalCenterHeader", "MedicalCenterText");

            // Creates a new MedicalCenterViewModel instance based on the page data
            var medicalCenterModel = new MedicalCenterViewModel(medicalCenterNode);

            return(View(medicalCenterModel));
        }
        public async Task <IActionResult> Add(MedicalCenterViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.medCenters
            .AddAsync(
                model.Name,
                model.Location);

            TempData.AddSuccessMessage($"Medical Center {model.Name}, {model.Location} added successfuly!");

            return(RedirectToAction(nameof(All)));
        }