public ActionResult Create(SolutionArchive solutionArchive, HttpPostedFileBase[] FileName)
        {
            for (int i = 0; i < FileName.Length; i++)
            {
                if (FileName[i] != null && FileName[i].ContentLength > 0)
                {
                    solutionArchive.FileName    = System.IO.Path.GetFileName(FileName[i].FileName);
                    solutionArchive.ContentType = FileName[i].ContentType;
                    using (var reader = new System.IO.BinaryReader(FileName[i].InputStream))
                    {
                        solutionArchive.Content = reader.ReadBytes(FileName[i].ContentLength);
                    }
                    db.SolutionArchive.Add(new SolutionArchive
                    {
                        ApplicationUserId = solutionArchive.ApplicationUserId,
                        Content           = solutionArchive.Content,
                        ContentType       = solutionArchive.ContentType,
                        SolutionId        = solutionArchive.SolutionId,
                        FileName          = solutionArchive.FileName
                    });
                }
            }
            db.SaveChanges();

            return(RedirectToAction("Edit", "Evidences", new { id = solutionArchive.SolutionId }));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SolutionArchive solutionArchive = db.SolutionArchive.Find(id);

            db.SolutionArchive.Remove(solutionArchive);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: SolutionArchives/Delete/5
        public ActionResult Delete(int?id)
        {
            SolutionArchive solutionArchive = db.SolutionArchive.Find(id);

            db.SolutionArchive.Remove(solutionArchive);
            db.SaveChanges();
            return(RedirectToAction("Index", "SolutionArchives", new { id = solutionArchive.SolutionId }));
        }
 public ActionResult Edit(SolutionArchive solutionArchive)
 {
     if (ModelState.IsValid)
     {
         db.Entry(solutionArchive).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ApplicationUserId = new SelectList(db.Users, "Id", "Name", solutionArchive.ApplicationUserId);
     ViewBag.SolutionId        = new SelectList(db.Solution, "Id", "Description", solutionArchive.SolutionId);
     return(View(solutionArchive));
 }
        // GET: SolutionArchives/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SolutionArchive solutionArchive = db.SolutionArchive.Find(id);

            if (solutionArchive == null)
            {
                return(HttpNotFound());
            }
            return(View(solutionArchive));
        }
        // GET: SolutionArchives/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SolutionArchive solutionArchive = db.SolutionArchive.Find(id);

            if (solutionArchive == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ApplicationUserId = new SelectList(db.Users, "Id", "Name", solutionArchive.ApplicationUserId);
            ViewBag.SolutionId        = new SelectList(db.Solution, "Id", "Description", solutionArchive.SolutionId);
            return(View(solutionArchive));
        }