Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            UserHasMaterial userHasMaterial = db.UserHasMaterials.Find(id);

            db.UserHasMaterials.Remove(userHasMaterial);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        // GET: UserHasMaterials/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserHasMaterial userHasMaterial = db.UserHasMaterials.Find(id);

            if (userHasMaterial == null)
            {
                return(HttpNotFound());
            }
            return(View(userHasMaterial));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,ReceiveDate,UserId,MaterialId")] UserHasMaterial userHasMaterial)
 {
     if (ModelState.IsValid)
     {
         userHasMaterial.Material        = db.Materials.Find(userHasMaterial.MaterialId);
         userHasMaterial.User            = db.Users.Find(userHasMaterial.UserId);
         db.Entry(userHasMaterial).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId     = new SelectList(db.Users, "Id", "Contraction", userHasMaterial.User.Id);
     ViewBag.MaterialId = new SelectList(db.Materials.Where(entity => !db.UserHasMaterials.Select(b => b.MaterialId).Contains(entity.Id)), "Id", "Serialnumber");
     return(View(userHasMaterial));
 }
Esempio n. 4
0
        // GET: UserHasMaterials/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserHasMaterial userHasMaterial = db.UserHasMaterials.Find(id);

            if (userHasMaterial == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserId     = new SelectList(db.Users, "Id", "Contraction", userHasMaterial.User.Id);
            ViewBag.MaterialId = new SelectList(db.Materials.Where(entity => !db.UserHasMaterials.Select(b => b.MaterialId).Contains(entity.Id)), "Id", "Serialnumber");
            return(View(userHasMaterial));
        }