Esempio n. 1
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));
        }
Esempio n. 2
0
        // GET: Image


        public ActionResult AddImage()

        {
            CycleDetail c1 = new CycleDetail();

            return(View(c1));
        }
        //HttpGet



        //Insert Cyclist that could be requested

        public ActionResult RequestCycle()

        {
            CycleDetail c1 = new CycleDetail();

            return(View(c1));
        }
Esempio n. 4
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));
        }