Exemplo n.º 1
0
        public ActionResult Create(File file)
        {
            if (ModelState.IsValid)
            {
                db.Files.Add(file);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.TypeID = new SelectList(db.Types, "TypeID", "Extension", file.TypeID);
            ViewBag.UserID = new SelectList(db.Users, "UserID", "Username", file.UserID);
            ViewBag.FolderID = new SelectList(db.Folders, "FolderID", "FolderName", file.FolderID);
            return View(file);
        }
Exemplo n.º 2
0
 public ActionResult Edit(File file)
 {
     if (ModelState.IsValid)
     {
         db.Entry(file).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TypeID = new SelectList(db.Types, "TypeID", "Extension", file.TypeID);
     ViewBag.UserID = new SelectList(db.Users, "UserID", "Username", file.UserID);
     ViewBag.FolderID = new SelectList(db.Folders, "FolderID", "FolderName", file.FolderID);
     return View(file);
 }