public ActionResult Edit(SampleModels sampleModels, HttpPostedFileBase LargeImage)
        {
            if (ModelState.IsValid)
            {
                SampleModelMethods sampleModelMethods = new SampleModelMethods();

                if (LargeImage != null)
                {
                    //deleting old large image file.
                    var oldLargeImageUrlPath = Path.Combine(HttpContext.Server.MapPath(sampleModels.LargeImageUrl));

                    //saving small image and receiving back their urls.
                    sampleModels.LargeImageUrl = sampleModelMethods.SaveLargeImage(LargeImage);
                    if (System.IO.File.Exists(oldLargeImageUrlPath))
                    {
                        System.IO.File.Delete(oldLargeImageUrlPath);
                    }
                }



                db.Entry(sampleModels).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(sampleModels));
        }
        public ActionResult Create([Bind(Include = "ModelId,Name,IsEnabled")] SampleModels sampleModels, HttpPostedFileBase LargeImage)
        {
            if (ModelState.IsValid)
            {
                if (LargeImage != null)
                {
                    //saving both small and large images and receiving back their urls.
                    SampleModelMethods sampleModelMethods = new SampleModelMethods();
                    sampleModels.LargeImageUrl = sampleModelMethods.SaveLargeImage(LargeImage);

                    //adding records to database..
                    db.models.Add(sampleModels);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Please Select an image for project.");
                }
                //db.models.Add(sampleModels);
                //db.SaveChanges();
                //return RedirectToAction("Index");
            }

            return(View(sampleModels));
        }