public ActionResult RequestCyclget()
        {
            BikesEntities1 db = new BikesEntities1();

            ViewBag.QualList = new SelectList(db.CycleDetails, "CycleID", "CycleType");
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult RequestName(CycleRequestedByUser rbu)
        {
            // try
            //{
            BikesEntities1 db = new BikesEntities1();

            // List<RequestCycle> rc = db.rc.ToList();

            //////int rid = rbu.RequestID;
            // int cid = rbu.CycleID;
            // DateTime fd = rbu.FromDate;
            //  DateTime td = rbu.ToDate;

            // CycleRequestedByUser crbu = new CycleRequestedByUser();
            // crbu.RequestID = rbu.RequestID;
            //crbu.CycleID = rbu.CycleID;
            //crbu.FromDate = (DateTime)rbu.FromDate;
            //  crbu.ToDate = (DateTime)rbu.ToDate;

            //select and insert statement

            db.CycleRequestedByUsers.Add(rbu);
            db.SaveChanges();
            //  }
            //catch (Exception ex)
            //  {
            //throw ex;


            //int RequestedCycleFromViewID = crbu.RequestID;

            return(View(rbu));
        }
Ejemplo n.º 3
0
        public ActionResult AddImage(CycleDetail model, HttpPostedFileBase image1)
        {
            //creating an object of the context class to save the file into database table.
            var db = new BikesEntities1();

            //check if the image1 (id or name) is not equal to null
            if (image1 != null)
            {
                //convert your image into binary format;

                model.CycleImage = new byte[image1.ContentLength];

                //inputstream is used to convert the actual data to binary format
                image1.InputStream.Read(model.CycleImage, 0, image1.ContentLength);
            }

            //save model into datacontext
            db.CycleDetails.Add(model);
            db.SaveChanges();
            ModelState.Clear();
            ViewBag.InsertedImageDetails = "Cycle Details were inserted successfully";


            return(View(model));
        }
Ejemplo n.º 4
0
        // GET: Cycle
        public ActionResult Index()
        {
            BikesEntities1     db    = new BikesEntities1();
            List <CycleDetail> clist = db.CycleDetails.ToList();

            return(View(clist));
        }
Ejemplo n.º 5
0
        public ActionResult DD()
        {
            var ddreq     = Session["ViewRequest"];
            var userddreq = Session["ViewUsername"];

            BikesEntities1 be = new BikesEntities1();
            //using (var be = new BikesEntities())
            //{
            //var x = db.RequestCycles.Include(c => c.CycleRequestedByUsers).Single(c => c.RequestID == id);

            //foreach (var mystep in ddreq)
            //var mystep = be.RequestCycles.Where(p => p.RequestID == id).FirstOrDefault();

            //{
            CycleRequestedByUser task = new CycleRequestedByUser();

            task.RequestID = ((Dec_21_ASP_Bikes.Models.RequestCycle)ddreq).RequestID;
            task.CycleID   = ((Dec_21_ASP_Bikes.Models.RequestCycle)ddreq).CycleID;
            task.FromDate  = ((Dec_21_ASP_Bikes.Models.RequestCycle)ddreq).FromDate;
            task.ToDate    = ((Dec_21_ASP_Bikes.Models.RequestCycle)ddreq).ToDate;
            task.Username  = ((Dec_21_ASP_Bikes.Models.Registration)userddreq).Username;

            be.CycleRequestedByUsers.Add(task);
            //}
            be.SaveChanges();
            return(View());

            //}
        }
Ejemplo n.º 6
0
        public ActionResult RegisterCycleUser(int id)
        {
            BikesEntities1 db = new BikesEntities1();
            List <CycleRequestedByUser> crequest = db.CycleRequestedByUsers.Where(s => s.RequestID == id).ToList();

            return(View(crequest));
        }
        // GET: UserRequestCycle
        public ActionResult userRaisesRequestForCycle(int id)
        {
            BikesEntities1 db  = new BikesEntities1();
            RequestCycle   urc = db.RequestCycles.Single(c => c.CycleID == id);

            return(View(urc));
        }
        public ActionResult ReturnCycle(CycleRequestedByUser cbru)
        {
            // var ddreq = Session["ViewRequest"];
            //var ddreq = Session["ViewRequest"];
            BikesEntities1 db = new BikesEntities1();

            //CycleRequestedByUser task = new CycleRequestedByUser();

            //var updateStatus = db.CycleRequestedByUsers.SingleOrDefault(w => w.Username == User.Identity.Name && w.RequestID == id);


            var updateStatus = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).OrderByDescending(x => x.UserRequest).Take(1).Single();

            updateStatus.Status    = false;
            updateStatus.CheckDate = DateTime.Now.Date;

            db.Entry(updateStatus).State = EntityState.Modified;

            db.SaveChanges();

            ViewBag.ReturnedCycle = "Hi " + User.Identity.Name +
                                    " 😎" + " You have successfully returned the 🚲 ." +
                                    " Please click the below link to request for a new 🚲";

            ViewBag.link = "👉👉👉👉";


            return(View());
        }
Ejemplo n.º 9
0
        //For Delete method
        public ActionResult DeleteSelected(string[] ids)
        {
            //Delete Selected
            int[] id = null;
            if (ids != null)
            {
                id = new int[ids.Length];
                int j = 0;
                foreach (string i in ids)
                {
                    int.TryParse(i, out id[j++]);
                }
            }

            if (id != null && id.Length > 0)
            {
                List <CycleDetail> allSelected = new List <CycleDetail>();
                using (BikesEntities1 db = new BikesEntities1())
                {
                    allSelected = db.CycleDetails.Where(a => id.Contains(a.CycleID)).ToList();
                    foreach (var i in allSelected)
                    {
                        db.CycleDetails.Remove(i);
                    }
                    db.SaveChanges();
                }
            }
            return(RedirectToAction("DeleteList"));
        }
        //User Profile Details

        public ActionResult UserProfileWithCycleDetails1()
        {
            BikesEntities1 db = new BikesEntities1();

            try
            {
                //var cycleList = db.CycleRequestedByUsers.ToList();

                List <CycleRequestedByUser> IfUsernameExitsInTable = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).ToList();
                // if (IfUsernameExitsInTable.Equals(null) || IfUsernameExitsInTable.Equals(false))
                if (IfUsernameExitsInTable.Count.Equals(0) || IfUsernameExitsInTable.Equals(false))
                {
                    //return Content("Cogratz.You are eligible to borrow a cycle");
                    //ViewBag.EligibleWhoNeverBorrowed = "Cogratzzzz " + User.Identity.Name + "You are eligible to borrow a cycle as you have never borrowed one";
                    ViewBag.EligibleWhoNeverBorrowed = "Hey " + User.Identity.Name + /*"👍👍👍👍" */ " 😎👌😊 " + " You have never borrowed a 🚲."
                                                       + " Please click the below link to view the 🚲 available";

                    ViewBag.link = "👉👉👉👉";;
                    //return View();
                }



                var UserWithCycleDetailsData = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).OrderByDescending(x => x.UserRequest).Take(1).Single();
                var HasCycleOnAccountOrNot   = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).OrderByDescending(x => x.UserRequest).Take(1).Single().Status;

                if (HasCycleOnAccountOrNot.Equals(false))
                {
                    // return RedirectToAction("RequestMe", "Test");

                    // return Content("Hi " + User.Identity.Name + ":" + "You have not borrowed any Cycles");
                    ViewBag.EligibleWhoReturnedPreviousOne = "Hi " + User.Identity.Name +
                                                             " 😎👌😊 " + " You have not borrowed a 🚲 ." +
                                                             " Please click the below link to view the 🚲 available";

                    ViewBag.link = "👉👉👉👉";

                    //return Content("Congratz. You are eligible since you have returned the previous one");
                    //  return View();
                }


                else if (HasCycleOnAccountOrNot.Equals(true))
                {
                    //return RedirectToAction("RestrictUserFromRequestingAnotherCycle", "Test");
                    // return Content("Hi " + User.Identity.Name + ":" + "You have not borrowed any Cycles");

                    //ViewBag.CheckFine = "Hey " + User.Identity.Name + ". ";
                    return(View(UserWithCycleDetailsData));
                }
            }

            catch (Exception)
            {
                // ViewBag.EligibleUser = "******";
            }

            return(View());
        }
Ejemplo n.º 11
0
        // This ActionMethod restricts the user based on the criteria by checking if the user already has the cycle on his account or if he is borrowing for the first time
        public ActionResult RestrictUserFromRequestingAnotherCycle()
        {
            BikesEntities1 db = new BikesEntities1();

            try
            {
                //var cycleList = db.CycleRequestedByUsers.ToList();
                //var check2NoUsername = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).Take(1).Single().Username;
                // var check2NoUsername = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).ToList();
                //var check2NoUsername = !((from u in db.CycleRequestedByUsers select u.Username).Contains(User.Identity.Name));
                //  var check2Username = db.CycleRequestedByUsers.Where!(a => a.Username == User.Identity.Name);

                List <CycleRequestedByUser> check2NoUsername = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).ToList();
                //var TestNoDataUser != check2NoUsername.ToList();


                if (check2NoUsername.Count.Equals(0) || check2NoUsername.Equals(false))
                {
                    return(Content("Cogratz.You are eligible to borrow a cycle"));
                }



                var check1UserExits = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).Take(1).Single().Username;

                var check2StatusInTable = db.CycleRequestedByUsers.Where(a => a.Username == User.Identity.Name).OrderByDescending(x => x.UserRequest).Take(1).Single().Status;


                if (check1UserExits.Equals(User.Identity.Name) && check2StatusInTable.Equals(true))
                {
                    //return RedirectToAction("RestrictUserFromRequestingAnotherCycle", "Test");
                    return(Content("Sorry. You are not eligible since you already have a cyle with you"));
                }
                else if (check1UserExits.Equals(User.Identity.Name) && check2StatusInTable.Equals(false))
                {
                    // return RedirectToAction("RequestMe", "Test");

                    return(Content("Congratz. You are eligible since you have returned the previous one"));
                }
                //else

                //else
                //{
                //    if (check2NoUsername == null || check2NoUsername.Equals(false))
                //    {
                //        return Content("Cogratz.You are eligible to borrow a cycle");
                //    }
                //}
            }

            catch (Exception ex)
            {
                throw ex;

                // ViewBag.EligibleUser = "******";
            }

            return(View());
        }
Ejemplo n.º 12
0
        //Display Image


        public ActionResult DisplayImage()
        {
            BikesEntities1 db        = new BikesEntities1();
            var            imageList = (from d in db.CycleDetails
                                        select d).ToList();

            return(View(imageList));
        }
Ejemplo n.º 13
0
        public override string[] GetRolesForUser(string username)
        {
            BikesEntities1 db = new BikesEntities1();
            string         s  = db.Registrations.Where(u => u.Username == username).FirstOrDefault().Role;

            string[] results = { s };
            return(results);
        }
        public ActionResult display()

        {
            BikesEntities1 db = new BikesEntities1();
            var            x  = db.RegistrationAndCycleRequestedByUsers.ToList();

            return(View(x));
        }
Ejemplo n.º 15
0
        public ActionResult Details(int?id)
        {
            BikesEntities1 db = new BikesEntities1();

            //We need a single cycle out of the list where the ID of the Cycle should be equal to the ID that we are passing into the dEtails action method

            RequestCycle singleCycleDetails = db.RequestCycles.Single(c => c.RequestID == id);

            return(View(singleCycleDetails));
        }
Ejemplo n.º 16
0
        //Print as Documents

        public ActionResult Report(string id)
        {
            LocalReport lr   = new LocalReport();
            string      path = Path.Combine(Server.MapPath("~/Reports"), "Registration.rdlc");

            if (System.IO.File.Exists(path))
            {
                lr.ReportPath = path;
            }
            else
            {
                return(View("Index"));
            }
            List <Registration> cm = new List <Registration>();

            using (BikesEntities1 dc = new BikesEntities1())
            {
                cm = dc.Registrations.ToList();
            }
            ReportDataSource rd = new ReportDataSource("RegisteredStudentList", cm);

            lr.DataSources.Add(rd);
            string reportType = id;
            string mimeType;
            string encoding;
            string fileNameExtension;



            string deviceInfo =

                "<DeviceInfo>" +
                "  <OutputFormat>" + id + "</OutputFormat>" +
                "  <PageWidth>8.5in</PageWidth>" +
                "  <PageHeight>11in</PageHeight>" +
                "  <MarginTop>0.5in</MarginTop>" +
                "  <MarginLeft>1in</MarginLeft>" +
                "  <MarginRight>1in</MarginRight>" +
                "  <MarginBottom>0.5in</MarginBottom>" +
                "</DeviceInfo>";

            Warning[] warnings;
            string[]  streams;
            byte[]    renderedBytes;

            renderedBytes = lr.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);
            return(File(renderedBytes, mimeType));
        }
Ejemplo n.º 17
0
        //Delete Cycle Details from Web Grid

        public ActionResult DeleteList()
        {
            List <CycleDetail> allCycles = new List <CycleDetail>();

            // Here BikeEntities is our Data Context
            using (BikesEntities1 db = new BikesEntities1())
            {
                allCycles = db.CycleDetails.ToList();
            }
            return(View(allCycles));
        }
Ejemplo n.º 18
0
        //public ActionResult DeleteStudents(string[] ids)
        //{
        //	//Delete Selected
        //	long [] id = null;
        //	if (ids != null)
        //	{
        //		id = new long[ids.Length];
        //		int j = 0;
        //		foreach (string i in ids)
        //		{
        //			long.TryParse(i, out id[j++]);
        //		}
        //	}

        //	if (id != null && id.Length > 0)
        //	{
        //		List<Registration> allSelected = new List<Registration>();
        //		using (BikesEntities1 db = new BikesEntities1())
        //		{
        //			allSelected = db.Registrations.Where(a => id.Contains(a.StudentID)).ToList();
        //			foreach (var i in allSelected)
        //			{
        //				db.Registrations.Remove(i);
        //			}
        //			db.SaveChanges();
        //		}
        //	}
        //	return RedirectToAction("Report_Registration");
        //}



        ////Disabling Students

        //public ActionResult DisableStudents()
        //{
        //      BikesEntities1 db = new BikesEntities1();

        //    var check1StudentExits = db.Registrations.Where(a => a.Username == User.Identity.Name).Take(1).Single().Username;

        //    var check2StatusInTable = db.CycleRequestedByUsers.Where(a => a.Username == d).OrderByDescending(x => x.UserRequest).Take(1).Single().Status;


        //    if (check1UserExits.Equals(User.Identity.Name) && check2StatusInTable.Equals(true))
        //    {
        //        //return RedirectToAction("RestrictUserFromRequestingAnotherCycle", "Test");
        //        //return Content("Sorry. You are not eligible since you already have a cyle with you");

        //        ViewBag.UserALreadyHasBorrowed = "Sorry " + User.Identity.Name + "😰😰😰😰." + " You are not eligible since you already have a 🚲 with you";

        //        ViewBag.link = "👉👉👉👉";

        //        //return Content("Congratz. You are eligible since you have returned the previous one");
        //        return View();


        //    }
        //    return View();

        //}



        //Report Generation for the Bicycles borrowed

        public ActionResult Report_CyclesBorrowed()

        {
            List <CycleRequestedByUser> allCyclesBorrowed = new List <CycleRequestedByUser>();

            // Here BikeEntities is our Data Context
            using (BikesEntities1 db = new BikesEntities1())
            {
                allCyclesBorrowed = db.CycleRequestedByUsers.ToList();
            }
            return(View(allCyclesBorrowed));
        }
Ejemplo n.º 19
0
        public ActionResult UserProfile()
        {
            BikesEntities1 db = new BikesEntities1();
            {
                var user = db.Registrations.Where(p => p.Username == User.Identity.Name).FirstOrDefault();
                // var user = from d in db.Registrations where (d.Username == User.Identity.Name) select d;

                //if user has cycle on his account
                ViewBag.CheckFine = " View Fine ";
                return(View(user));
            }
        }
Ejemplo n.º 20
0
 public ActionResult New(RequestCycle reg)
 {
     if (ModelState.IsValid)
     {
         BikesEntities1 db = new BikesEntities1();
         db.RequestCycles.Add(reg);
         db.SaveChanges();
         ModelState.Clear();
         reg = null;
         ViewBag.SuccessRegistration = "Registration was successfull";
     }
     return(View());
 }
Ejemplo n.º 21
0
        public ActionResult Login(DeactivationWithLoginViewModel u)
        {
            // this action is for handle post (login)
            if (ModelState.IsValid) // this is check validity
            {
                using (BikesEntities1 db = new BikesEntities1())
                {
                    var v = db.Registrations.Where(a => a.Username.Equals(u.Username) && a.Password.Equals(u.Password)).FirstOrDefault();


                    var check1UserExits     = db.Registrations.Where(a => a.Username == User.Identity.Name).Take(1).Single().Username;
                    var check2StatusInTable = db.Registrations.Where(a => a.Username == User.Identity.Name).Take(1).Single().Status;

                    // db.RequestCycles.Include(c => c.CycleDetail).Single(c => c.RequestID == id);


                    var Table3ToDate = db.Registrations.Include(a => a.CycleRequestedByUsers).Where(a => a.Username == User.Identity.Name).Take(1).Single().CycleRequestedByUsers.Take(1).Single().ToDate;
                    var cekDate      = db.Registrations.Include(a => a.CycleRequestedByUsers).Where(a => a.Username == User.Identity.Name).Take(1).Single().CycleRequestedByUsers.Take(1).Single().CheckDate;


                    //var check1UserExits = db.Registrations.Where(a => a.Username == User.Identity.Name).Take(1).Single().Username;
                    // var check2StatusInTable = db.Registrations.Where(a => a.Username == User.Identity.Name).Take(1).Single().Status;

                    if (v != null && v.Status.Equals(true))
                    {
                        FormsAuthentication.SetAuthCookie(u.Username, false);
                        ModelState.Clear();
                        return(RedirectToAction("AboutUs", "Home"));
                    }
                    else if (v != null && DateTime.Now.Date >= cekDate)
                    {
                        var updateStatus = db.Registrations.Where(a => a.Username == User.Identity.Name).Take(1).Single();
                        //var updateStatus = db.Registrations.Where(a => a.Username == User.Identity.Name).Take(1).Single().Status;
                        updateStatus.Status = false;
                        // updateStatus.CheckDate = DateTime.Now.Date;

                        db.Entry(updateStatus).State = EntityState.Modified;

                        db.SaveChanges();
                        ViewBag.NotifyUser = "******" + User.Identity.Name + ". You account has been disabled."
                                             + " Please contact admin for further assistance.";

                        ViewBag.SendEmail = "";
                        return(View());
                        // return Content("Your account is inactive");
                    }
                }
            }
            return(View());
        }
Ejemplo n.º 22
0
        public ActionResult Details(int?id)
        {
            BikesEntities1 db = new BikesEntities1();

            //We need a single cycle out of the list where the ID of the Cycle should be equal to the ID that we are passing into the dEtails action method



            // var query = db.CycleDetails.Join(db.rc, r => r.CycleID, p => p.CycleID, (r, p) => new { r.CycleImage, r.CycleAccessories, r.CycleType, r.CycleID, p.RequestID, p.FromDate, p.ToDate });

            CycleDetail singleCycleDetails = db.CycleDetails.Single(c => c.CycleID == id);

            return(View(singleCycleDetails));
        }
Ejemplo n.º 23
0
        // GET: LoggedInUserProfilePage
        public ActionResult Details(int id)
        {
            BikesEntities1       db       = new BikesEntities1();
            UserProfileViewModel userView = new UserProfileViewModel();

            userView.regUserProfile        = (from o in db.Registrations select o).ToList();
            userView.reqCycleUserProfile   = (from or in db.RequestCycles select or).ToList();
            userView.cycDetailsUserProfile = (from or in db.CycleDetails select or).ToList();

            return(View(userView));


            //Order order = db.Orders.Find(id);
            //return View(order);
        }
        public ActionResult display1()

        {
            //var reg = new Registration();
            //var crbu = new CycleRequestedByUser();
            //FirstAndLastViewModel db = new FirstAndLastViewModel()
            //{
            //    RVM = reg,
            //    CVM = crbu

            //};



            //db.Registrations.Include(c => c.CycleRequestedByUsers);
            //List<UserProfileAndCycleDetailsViewModel> joindata = (from c in db.Registrations join n in db.CycleRequestedByUsers
            //                                                on c.StudentID equals n.UserRequest select new UserProfileAndCycleDetailsViewModel
            //    { StudentID = c.StudentID, Fullname = c.Fullname, RequestID = n.RequestID,  FromDate = n.FromDate, ToDate = n.ToDate}).ToList();

            //return View(joindata);


            //NewModel vm = new NewModel();
            // var StudentDetails = db.Registrations.Include(c => c.CycleRequestedByUsers);
            BikesEntities1 db = new BikesEntities1();

            //var StudentDetails = (from c in db.Registrations
            //                      join e in db.CycleRequestedByUsers on c.StudentID equals e.StudentID
            //                      where c.Username == User.Identity.Name
            //                      select c.Fullname);



            var details = from n in db.Registrations
                          join c in db.CycleRequestedByUsers on n.Username equals c.Username

                          select new { n.Fullname, n.StudentID, c.UserRequest, c.RequestID, c.FromDate, c.ToDate };



            // return View(db);


            //Order order = db.Orders.Find(id);
            return(View(details));
        }
Ejemplo n.º 25
0
        public ActionResult ReturnCycle(CycleRequestedByUser cbru, int id)
        {
            // var ddreq = Session["ViewRequest"];
            //var ddreq = Session["ViewRequest"];
            BikesEntities1 db = new BikesEntities1();

            //CycleRequestedByUser task = new CycleRequestedByUser();

            var updateStatus = db.CycleRequestedByUsers.SingleOrDefault(w => w.Username == User.Identity.Name && w.RequestID == id);

            updateStatus.Status = false;

            db.Entry(updateStatus).State = EntityState.Modified;

            db.SaveChanges();
            return(View());
        }
Ejemplo n.º 26
0
 public ActionResult RegisterCycle(CycleRequestedByUser U)
 {
     if (ModelState.IsValid)
     {
         using (BikesEntities1 db = new BikesEntities1())
         {
             //you should check duplicate registration here
             db.CycleRequestedByUsers.Add(U);
             db.SaveChanges();
             ModelState.Clear();
             U = null;
             ViewBag.registrationSuccess = "Registration was Successfull. Welcome ";
             // return RedirectToAction("Index", "Home");
         }
     }
     return(View(U));
 }
Ejemplo n.º 27
0
        //Report


        public ActionResult Report_Registration()

        /*{
         * using (BikesEntities dc = new BikesEntities())
         * {
         * var v = dc.Registrations.ToList();
         * return View(v);
         * }
         * }*/

        {
            List <Registration> allStudents = new List <Registration>();

            // Here BikeEntities is our Data Context
            using (BikesEntities1 db = new BikesEntities1())
            {
                allStudents = db.Registrations.ToList();
            }
            return(View(allStudents));
        }
Ejemplo n.º 28
0
        public ActionResult TestingUniqueRequestID(int id)
        {
            BikesEntities1 db = new BikesEntities1();
            //List<RequestCycle> crequest = db.RequestCycles.Where(s => s.RequestID == id).ToList();
            // List<RequestCycle> crequest = db.RequestCycles.Include(c => c.CycleRequestedByUsers).Where(s => s.CycleID == id).ToList();


            //var query = db.RequestCycles.Join <RequestCycle, CycleRequestedByUser, int, RequestCycle>
            //    ( db.CycleRequestedByUsers, a => a.RequestID, b => b.RequestID,(a, b) => a).ToList();


            //ViewBag.towns = new SelectList(towns.Where(x => x.Name == x.Name.Distinct()).ToList(), "Value", "Text");
            //ViewBag.towns = new SelectList(towns.Where(x => x.Name == x.Name.Distinct()).ToList(), "Value", "Text");
            //var query = db.RequestCycles.Select(i => i.RequestID).Distinct();

            //var query = (from u in db.CycleRequestedByUsers join r in db.RequestCycles on u.RequestID equals r.RequestID  select r).Distinct();

            //var query = (from u in db.CycleRequestedByUsers join r in db.RequestCycles on u.RequestID equals r.RequestID select r).Distinct();

            //var query = from w in db.RequestCycles
            //            join c in db.CycleRequestedByUsers on w.RequestID equals c.RequestID
            //            where w.RequestID != c.RequestID
            //            select w;

            List <RequestCycle> crequest = db.RequestCycles.Where(s => s.CycleID == id).ToList();


            //var query = (from r in db.RequestCycles
            //             where !(from u in db.CycleRequestedByUsers
            //                     select u.RequestID).Contains(r.RequestID)
            //             select r).Distinct();

            var query = (from r in crequest
                         where !(from u in db.CycleRequestedByUsers
                                 select u.RequestID).Contains(r.RequestID)
                         select r).Distinct();



            return(View(query));
        }
Ejemplo n.º 29
0
        //        public ActionResult RequestName(int id)
        //        {
        //            BikesEntities1 db = new BikesEntities1();
        //            // List<RequestCycle> crequest = db.RequestCycles.Where(s => s.CycleID == id).ToList();
        //            // List<RequestCycle> crequest = db.RequestCycles.Include(c=> c.CycleRequestedByUsers).Distinct().Where(s => s.CycleID == id).ToList();
        //            List<RequestCycle> crequest = db.RequestCycles.Where(s => s.CycleID == id).ToList();


        //            var query = (from r in db.RequestCycles
        //                         where !(from u in db.CycleRequestedByUsers
        //                                 select u.RequestID).Contains(r.RequestID)
        //                         select r).Distinct();
        //           // var rid = query.Select(q => q.RequestID == cid);
        //            return View();

        //}



        public ActionResult RequestName(int id, int?page)
        {
            BikesEntities1 db = new BikesEntities1();
            // List<RequestCycle> crequest = db.RequestCycles.Where(s => s.CycleID == id).ToList();
            // List<RequestCycle> crequest = db.RequestCycles.Include(c=> c.CycleRequestedByUsers).Distinct().Where(s => s.CycleID == id).ToList();
            // List<RequestCycle> crequest = db.RequestCycles.Where(s => s.RequestID == id).ToList();


            //var query = (from r in db.RequestCycles
            //             where !(from u in db.CycleRequestedByUsers
            //                     select u.RequestID).Contains(r.RequestID)
            //             select r).Distinct();
            //return View(query.ToList().ToPagedList(page ?? 1, 7));

            var query = (from r in db.RequestCycles
                         where !(from u in db.CycleRequestedByUsers
                                 select u.RequestID).Contains(r.RequestID)
                         select r).Distinct().Where(r => r.CycleID == id);

            return(View(query.ToList().ToPagedList(page ?? 1, 7)));
        }
Ejemplo n.º 30
0
        public ActionResult Register(Registration U)
        {
            if (ModelState.IsValid)
            {
                using (BikesEntities1 db = new BikesEntities1())
                {
                    //you should check duplicate registration here

                    db.Registrations.Add(U);

                    db.SaveChanges();

                    ModelState.Clear();
                    U = null;


                    ViewBag.SuccessMessage = "Congratzzzz 👍👍👍👍.  Your registration was successfull";
                    ViewBag.link           = "👉👉👉👉";
                }
            }
            return(View(U));
        }