public ActionResult Activity_Browse_DateFilter(activity_volunteerNo_VM avvm) { DateTime startDate = (DateTime)avvm.Activity_startdate; DateTime endDate = (DateTime)avvm.Activity_enddate; int activity_typeID = (int)avvm.Activity_type_ID; Activity_Photo_Schedule_typeVM vm = new Activity_Photo_Schedule_typeVM(); activity_volunteerNo_VM actvm = new activity_volunteerNo_VM(); vm.acvno_VM = actvm.activity_By_Activity_type_ID(activity_typeID, startDate, endDate, Convert.ToInt32(Session["UserID"])); vm.activity_types = db.Activity_type.ToList(); ViewBag.userid = Session["UserID"]; ViewBag.Activity_type_ID = activity_typeID; //找出活動類別 放到 ViewBag.acty var t = vm.acvno_VM.Where(v => v.Activity_type_ID == avvm.Activity_type_ID).Select(a => a.Activity_type1).Distinct().ToList(); ViewBag.acty = t[0]; ViewBag.startDate = startDate; ViewBag.endDate = endDate; ViewBag.ss = false; if (ViewBag.startDate != null && ViewBag.endDate != null) { ViewBag.ss = true; } return(View("Activity_Browse", vm)); }
public ActionResult Activity_Browse(int id = 1) { //string a = null; //if(Request.Form.Count>0) //{ // a = Request.Form["activity_no"]; //} Activity_Photo_Schedule_typeVM vm = new Activity_Photo_Schedule_typeVM(); //vm.activity = db.Activities.Where(p => p.Activity_type_ID == id); activity_volunteerNo_VM actvm = new activity_volunteerNo_VM(); vm.acvno_VM = actvm.activity_By_Activity_type_ID(id, Convert.ToInt32(Session["UserID"])); vm.activity_types = db.Activity_type.ToList(); ViewBag.userid = Session["UserID"]; ViewBag.Activity_type_ID = id; //activity_volunteerNo_VM avvm = new activity_volunteerNo_VM(); //ViewBag.actNumOfPeople = avvm.activityNumberOfPeople(1107); return(View(vm)); }