public ActionResult Branch_Wise_Plan(Int64 ID) { try { var Branch_Selected = db.Planes.Join(db.Branch_Wise_Plane, j => j.ID, u => u.Plane_ID, (j, u) => new { Branch_Plane = u, Plane = j }).Where(i => i.Branch_Plane.Branch_ID == ID).ToList(); List <Branch_Wise_PlanePlaneModel> Branch_Wise_PlanePlaneModelList = new List <Branch_Wise_PlanePlaneModel>(); foreach (var d in Branch_Selected) { Branch_Wise_PlanePlaneModel Branch_Wise_PlaneBranchModel = new Branch_Wise_PlanePlaneModel(); PlaneModel PlaneModel = new PlaneModel(); Branch_Wise_PlaneModel Branch_Wise_PlaneModel = new Branch_Wise_PlaneModel(); PlaneModel.Name = d.Plane.Name; PlaneModel.Duration = d.Plane.Duration; PlaneModel.Duration_No = d.Plane.Duration_No; PlaneModel.Worth = d.Plane.Worth; Branch_Wise_PlaneModel.Status = d.Branch_Plane.Status; Branch_Wise_PlaneModel.ID = d.Branch_Plane.ID; Branch_Wise_PlaneBranchModel.PlaneModel = PlaneModel; Branch_Wise_PlaneBranchModel.Branch_Wise_PlaneModel = Branch_Wise_PlaneModel; Branch_Wise_PlanePlaneModelList.Add(Branch_Wise_PlaneBranchModel); } return(View(Branch_Wise_PlanePlaneModelList)); } catch (Exception ex) { return(RedirectToAction("Contact", "Home")); } }
public ActionResult Gym_Wise_Plan(Int64 ID) { try { int GYM_ID = Convert.ToInt32(Session["GYM_ID"]); var Branch_Selected = db.Branches.Join(db.Branch_Wise_Plane, j => j.ID, u => u.Branch_ID, (j, u) => new { Branch_Plane = u, Branch = j }).Where(i => i.Branch.GYM_ID == GYM_ID && i.Branch_Plane.Plane_ID == ID).ToList(); List <Branch_Wise_PlaneBranchModel> Branch_Wise_PlaneBranchModelList = new List <Branch_Wise_PlaneBranchModel>(); foreach (var d in Branch_Selected) { Branch_Wise_PlaneBranchModel Branch_Wise_PlaneBranchModel = new Branch_Wise_PlaneBranchModel(); BranchModel BranchModel = new BranchModel(); Branch_Wise_PlaneModel Branch_Wise_PlaneModel = new Branch_Wise_PlaneModel(); BranchModel.Area = d.Branch.Area; BranchModel.Building_Name = d.Branch.Building_Name; BranchModel.Landmark = d.Branch.Landmark; BranchModel.Name = d.Branch.Name; Branch_Wise_PlaneModel.Status = d.Branch_Plane.Status; Branch_Wise_PlaneModel.ID = d.Branch_Plane.ID; Branch_Wise_PlaneBranchModel.Branch = BranchModel; Branch_Wise_PlaneBranchModel.Branch_Wise_PlaneModel = Branch_Wise_PlaneModel; Branch_Wise_PlaneBranchModelList.Add(Branch_Wise_PlaneBranchModel); } return(View(Branch_Wise_PlaneBranchModelList)); } catch (Exception ex) { return(RedirectToAction("Contact", "Home")); } }