Beispiel #1
0
 public ActionResult Edit([Bind(Include = "FurnitureID,FurnitureName,FurnitureImg,buildLevel,furnitureType,BoardFootEst,AdditionalNotes,CompletedBefore")] Furniture furniture)
 {
     if (ModelState.IsValid)
     {
         db.Entry(furniture).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(furniture));
 }
        public ActionResult Edit([Bind(Include = "FurniturePartId,FurnitureIndex,PartName,PartCount,Width,Length,BoardThickness,partBoardFoot,PartNotes,PartImgUrl")] FurniturePart furniturePart)
        {
            if (ModelState.IsValid)
            {
                db.Entry(furniturePart).State = EntityState.Modified;

                furniturePart.partBoardFoot = 0;
                double BoardFoot = furniturePart.PartCount * ((furniturePart.Width * furniturePart.Length * furniturePart.BoardThickness) / 144);
                BoardFoot = Math.Round(BoardFoot, 4);
                furniturePart.partBoardFoot = BoardFoot;


                db.SaveChanges();
                var id = furniturePart.FurnitureIndex;                         //FurnitureID = FurnitureIndex
                return(RedirectToAction("Details", "Furnitures", new { id })); //Back to Furniture Details View
            }
            return(View("Index", "Furnitures"));
        }