Пример #1
0
        public IActionResult OnGet(int id)
        {
            Clinic = clinicData.GetClinicById(id);
            if (Clinic == null)
            {
                return(RedirectToPage("~/NotFound"));
            }

            return(Page());
        }
Пример #2
0
 public IActionResult OnGet(int?id)
 {
     if (id.HasValue)
     {
         Clinic = clinicData.GetClinicById(id.Value);
         if (Clinic == null)
         {
             return(RedirectToPage("~/NotFound"));
         }
     }
     else
     {
         Clinic = new Core.Clinic();
     }
     return(Page());
 }
Пример #3
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                if (Clinic.Id == 0)
                {
                    Clinic = clinicData.Create(Clinic);
                    TempData["TempMessage"] = "New clinic is created!";
                }
                else
                {
                    Clinic = clinicData.Update(Clinic);
                    TempData["TempMessage"] = "Clinic details are updated";
                }

                clinicData.Commit();
                return(RedirectToPage("./List"));
            }
            return(Page());
        }