Exemplo n.º 1
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var clinic = clinicData.GetClinicById(Doctor.ClinicId);
                Doctor.Clinic = clinic;
                if (Doctor.Id == 0)
                {
                    Doctor = doctorData.Create(Doctor);
                    TempData["TempMessage"] = "New doctor is hired!";
                }
                else
                {
                    Doctor = doctorData.Update(Doctor);
                    TempData["TempMessage"] = "Doctor information is updated!";
                }

                doctorData.Commit();
                return(RedirectToPage("./List"));
            }
            var clinics = clinicData.GetClinics().ToList().Select(p => new { Id = p.Id, Display = p.Name });

            Clinics = new SelectList(clinics, "Id", "Display");
            Gender  = htmlHelper.GetEnumSelectList <Gender>();
            return(Page());
        }
Exemplo n.º 2
0
        public IActionResult OnGet(int id)
        {
            Clinic = clinicData.GetClinicById(id);
            if (Clinic == null)
            {
                return(RedirectToPage("~/NotFound"));
            }

            return(Page());
        }
Exemplo n.º 3
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());
 }