public ActionResult Create([Bind(Include = "ID,Title,Description,Tagline,SourceCode,Lead,")] Product product)
        {
            if (ModelState.IsValid)
            {
                // add screenshots
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFileBase file = Request.Files[i];
                    if (file != null && file.ContentLength > 0)
                    {
                        file.InputStream.Position = 0;
                        Screenshot Screen = new Screenshot();
                        Screen.ProductID = product.ID;
                        Screen.Product = product;
                        using (var memoryStream = new MemoryStream())
                        {
                            file.InputStream.CopyTo(memoryStream);
                            Screen.ScreenShot1 = memoryStream.ToArray();
                        }
                        product.Screenshots.Add(Screen);
                    }
                }

                db.Products.Add(product);
                db.SaveChanges();

                if (Request.Files.Count == 0)
                {
                    return RedirectToAction("Index");
                }
                else
                {
                    var t = RedirectToAction("Index");

                    return Json(new { ErrorMessage = "", RedirectURL = Url.Action("Index",null, null, Request.Url.Scheme) });
                }
            }
            return View(product);
        }
 /// <summary>
 /// ScreenShot DTO Constructor
 /// </summary>
 /// <param name="screenshot"></param>
 public ScreenShotDTO(Screenshot screenshot)
 {
     this.ID = screenshot.ID;
     this.ScreenShot1 = screenshot.ScreenShot1;
 }
        public IHttpActionResult PutScreenshot(int id, Screenshot screenshot)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != screenshot.ID)
            {
                return BadRequest();
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ScreenshotExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }