public async Task <IActionResult> Edit(int id, [Bind("ScheduleTypeId,DoctorId,DayId,Time,ManagerSignature,EntryDate")] DoctorsSchedule doctorsSchedule) { if (id != doctorsSchedule.ScheduleTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(doctorsSchedule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoctorsScheduleExists(doctorsSchedule.ScheduleTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DayId"] = new SelectList(_context.Days, "DayId", "DayName", doctorsSchedule.DayId); ViewData["DoctorId"] = new SelectList(_context.Doctors, "DoctorId", "Description", doctorsSchedule.DoctorId); return(View(doctorsSchedule)); }
public async Task <IActionResult> Create([Bind("ScheduleTypeId,DoctorId,DayId,Time,ManagerSignature,EntryDate")] DoctorsSchedule doctorsSchedule) { if (ModelState.IsValid) { _context.Add(doctorsSchedule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DayId"] = new SelectList(_context.Days, "DayId", "DayName", doctorsSchedule.DayId); ViewData["DoctorId"] = new SelectList(_context.Doctors, "DoctorId", "Description", doctorsSchedule.DoctorId); return(View(doctorsSchedule)); }
public ActionResult Appointment(DoctorsSchedule doctorsSchedule) { doctorsSchedule.CreatedDate = DateTime.UtcNow.ToLocalTime(); if (ModelState.IsValid) {//ToDo : select user from session doctorsSchedule.UserId = (int)Session["UserId"]; db.DoctorsSchedules.Add(doctorsSchedule); db.SaveChanges(); ViewBag.SucessFullySaved = true; return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ViewResult EditDoctorShedule(int id, string personid, int emplolyeeid) { Employee employee = _employeeRepository.GetEmployee(emplolyeeid); ApplicationUser person = _employeeRepository.GetPerson(personid); DoctorsSchedule doctorsSchedule = _doctorsScheduleRepository.GetDoctorsSchedule(id); DoctorSheduleViewModel doctorSheduleViewModel = new DoctorSheduleViewModel { Id = doctorsSchedule.Id, Name = person.Name, EmployeeId = doctorsSchedule.EmployeeId, Day = doctorsSchedule.Day, Time = doctorsSchedule.Time }; return(View(doctorSheduleViewModel)); }
public ViewResult EditDoctorShedule(DoctorSheduleViewModel model) { if (ModelState.IsValid) { //Employee employee = _employeeRepository.GetEmployee(model.EmployeeId); //ApplicationUser person = _employeeRepository.GetPerson(model.PersonId); DoctorsSchedule doctorsSchedule = _doctorsScheduleRepository.GetDoctorsSchedule(model.Id); doctorsSchedule.Id = model.Id; doctorsSchedule.EmployeeId = model.EmployeeId; doctorsSchedule.Day = model.Day; doctorsSchedule.Time = model.Time; DoctorsSchedule updatedoctorschedule = _doctorsScheduleRepository.Update(doctorsSchedule); } //return RedirectToAction("ListDoctorShedule"); return(View(model)); }
public IActionResult CreateDoctorShedule(DoctorsSchedule model) { if (ModelState.IsValid) { DoctorsSchedule newDoctorsSchedule = new DoctorsSchedule { EmployeeId = model.EmployeeId, Day = model.Day, Time = model.Time, IUser = 1, IDate = DateTime.Now, }; _doctorsScheduleRepository.Add(newDoctorsSchedule); return(RedirectToAction("ListDoctorShedule")); } return(View()); }
public ViewResult ListDoctorShedule() { DoctorsSchedule model = new DoctorsSchedule(); List <DoctorsScheduleView> doctorseduleList = (from p in _accountRepository.GetAllPerson() join e in _employeeRepository.GetAllEmployees() on p.Id equals e.PersonId join ds in _doctorsScheduleRepository.GetAllDoctorsSchedule() on e.Id equals ds.EmployeeId select new DoctorsScheduleView { PersonId = p.Id, Id = ds.Id, EmployeeId = ds.EmployeeId, Name = p.Name, Day = ds.Day, Time = ds.Time }).OrderBy(x => x.Day).ThenBy(x => x.Time).ThenBy(x => x.Name).ToList(); model.DoctorsScheduleList = doctorseduleList; return(View(model)); }