public IActionResult Add() { #region LoadAddData List <LangDTO> langs = new ServiceNode <object, List <LangDTO> >(_fc).GetClient("/api/lang/all").Data; List <ServiceDTO> services = new ServiceNode <object, List <ServiceDTO> >(_fc).GetClient("/api/services/services/1").Data; var model = new DoctorAddViewModel(); model.Langs = langs; model.Services = services; #endregion return(View(model)); }
public IActionResult Add(DoctorAddViewModel viewModel) { if (ModelState.IsValid) { _userService.AddDoctor(viewModel); return(RedirectToAction("Index")); } var a = ModelState.ErrorCount; return(View(viewModel)); }
public void AddDcotor(DoctorAddViewModel doctorAddViewModel) { Doctor doctor = Doctor.Create(doctorAddViewModel.FirstName, doctorAddViewModel.LastName, doctorAddViewModel.ProfessionalTitle, doctorAddViewModel.ClinicId, doctorAddViewModel.ContactTel, doctorAddViewModel.Notes); //Doctor doctor = new Doctor(doctorAddViewModel.FirstName, doctorAddViewModel.LastName, // doctorAddViewModel.ProfessionalTitle, doctorAddViewModel.ClinicId, doctorAddViewModel.ContactTel, doctorAddViewModel.Notes); doctor.JoinDate = DateTime.Now; doctor.UpdateDate = DateTime.Now; _doctorReposiotry.Add(doctor); //return AutoMapper.Mapper.Map<Doctor, DoctorAddViewModel>(doctor); }
public IHttpActionResult AddDoctorToClinic(DoctorAddViewModel doctorModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _clinicApplicationService.AddDcotor(doctorModel); } catch (Exception) { throw; } return(Ok()); }