public static Reservation ToReservation(this ReservationIndex index) { Course course = null; if (!string.IsNullOrEmpty(index.CourseId) && !string.IsNullOrEmpty(index.CourseTitle) && index.CourseLevel.HasValue) { course = new Course { CourseId = index.CourseId, Title = index.CourseTitle, Level = index.CourseLevel.Value }; } return(new Reservation( null, index.ReservationId, index.AccountId, index.IsLevyAccount, index.CreatedDate, index.StartDate, index.ExpiryDate, (ReservationStatus)index.Status, course, index.ProviderId, index.AccountLegalEntityId, index.AccountLegalEntityName, index.TransferSenderAccountId, index.UserId)); }
// GET: Reservation 显示数据库中科室名称 public ActionResult Index(int?id) { if (Global.CurrentUserGroup == GroupType.Patient) { var list = db.SECTION_TYPE.ToArray(); List <DOCTOR> doclist = null; if (id != null) { doclist = db.DOCTOR.Where(m => m.SECTION_ID == id).ToList(); } var ri = new ReservationIndex() { DOCTOR_LIST = doclist ?? new List <DOCTOR>(), SECTION_LIST = list, }; return(View(ri)); } else if (Global.CurrentUserGroup == GroupType.Doctor) { return(RedirectToAction("Detail")); } return(RedirectToAction("../Home/Index"));//之前是home,大佬弄的时候是正常的,我弄的时候就崩了,所以改为了不会出错的跳主页面先,现在要登陆才能预约了 }