Пример #1
0
        public ActionResult Create(DoctorDetailsViewModel doctorDetailsViewModel)
        {
            doctorBusinessLayer = new DoctorBusinessLayer();
            userBusinessLayer   = new UserBusinessLayer();
            var user = userBusinessLayer.GetUserByEmail(doctorDetailsViewModel.Doctor.DoctorUser.Email);

            if (user != null)
            {
                ModelState.AddModelError("DoctorUser.Email", "Email already exists");
                return(View(doctorDetailsViewModel));
            }
            Doctor doctor = new Doctor();

            doctor.ShiftTime = new List <DoctorTime>();
            doctor           = doctorDetailsViewModel.Doctor;
            doctorBusinessLayer.AddDoctor(doctor, doctorDetailsViewModel.Timings);

            Logging.loggInfo($"Doctor addedd with Userid = {doctor.DoctorUser.Id} and Name = {doctor.DoctorUser.Name} ");
            return(RedirectToAction("Index"));
        }