public virtual ActionResult AddDoctor()
        {
            var vm = new AddDoctorViewModel {
                Id = Guid.Empty
            };

            return(View(MVC.Home.Views.AddDoctor, vm));
        }
        public ActionResult AddDoctor()
        {
            var model = new AddDoctorViewModel()
            {
                Specialty = adminService.GetSpecialty()
            };

            return(View(model));
        }
        public ActionResult AddDoctor()
        {
            //var user = adminService.GetUserById(UserProfile.Id);
            var model = new AddDoctorViewModel()
            {
                Specialty = adminService.GetSpecialty()
            };

            return(View(model));
        }
예제 #4
0
        public AddDoctorPage(List <Models.Genders> genderses, List <Models.Departments> DepartmentsList, List <Models.Experience> ExperienceList)
        {
            var TheViewModel = new AddDoctorViewModel();

            BindingContext = TheViewModel;
            InitializeComponent();

            PickerGender.ItemsSource     = genderses.ToList();
            ExperiencePicker.ItemsSource = ExperienceList.ToList();
            deptpicker.ItemsSource       = DepartmentsList.ToList();
        }
        public static bool SaveDoctor(AddDoctorViewModel vm)
        {
            var result   = false;
            var recordId = DoctorsDetailDA.SaveDoctor(vm);

            if (recordId != Guid.Empty)
            {
                result = true;
            }

            return(result);
        }
        public ActionResult AddDoctor(AddDoctorViewModel model)
        {
            if (ModelState.IsValid)
            {
                var specialty = this.Data.Specialities.GetById(model.SpecialityId);
                var doc       = Mapper.Map <UserInfo>(model);
                doc.Image     = this.adminService.GetImage(model);
                doc.Specialty = specialty;
                this.Data.Doctors.Add(doc);
                this.Data.SaveChanges();

                return(RedirectToAction("AllDoctors"));
            }

            return(View(model));
        }
예제 #7
0
        public static Guid SaveDoctor(AddDoctorViewModel vm)
        {
            using (var db = new DataClassesDataContext())
            {
                var record = new DoctorDetail()
                {
                    Id          = vm.Id,
                    DName       = vm.Name,
                    DAddress    = vm.Address,
                    PhoneNumber = vm.PhoneNumber
                };

                db.DoctorDetails.InsertOnSubmit(record);
                db.SubmitChanges();

                return(record.Id);
            }
        }
예제 #8
0
        public Image GetImage(AddDoctorViewModel doctor)
        {
            var file = new Image();

            if (doctor.ImageUpload != null)
            {
                file.FileName = doctor.ImageUpload.FileName;

                using (var memory = new MemoryStream())
                {
                    doctor.ImageUpload.InputStream.CopyTo(memory);
                    var content = memory.GetBuffer();
                    file.Content = content;
                }
            }

            return(file);
        }
        public virtual ActionResult SaveDoctor(AddDoctorViewModel addDoctorViewModel)
        {
            if (ModelState.IsValid)
            {
                if (addDoctorViewModel.Id == Guid.Empty)
                {
                    addDoctorViewModel.Id = Guid.NewGuid();
                }

                var result = DoctorsDetailService.SaveDoctor(addDoctorViewModel);
                if (result)
                {
                    return(RedirectToAction(MVC.Home.ActionNames.Index));
                }
                else
                {
                    ModelState.AddModelError("Error", "Unexpected error");
                }
            }
            return(View(MVC.Home.Views.AddDoctor, addDoctorViewModel));
        }
예제 #10
0
 public AddDoctorView(MainViewModel mainVM)
 {
     InitializeComponent();
     DataContext = new AddDoctorViewModel(mainVM);
 }
예제 #11
0
 public AddDoctorView()
 {
     InitializeComponent();
     DataContext = new AddDoctorViewModel(this);
 }