Example #1
0
        public ActionResult Edit(int id, ExComponentEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.ExterId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = CreateExComponentService();

            if (service.UpdateExComponent(model))
            {
                TempData["SaveResult"] = "The property was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "The property could not be updated.");

            return(View(model));
        }
Example #2
0
        public ActionResult Edit(int id)
        {
            var service = CreateExComponentService();
            var detail  = service.GetExComponentById(id);

            var model =
                new ExComponentEdit
            {
                ExterId                = detail.ExterId,
                Foundation             = detail.Foundation,
                FoundationCondition    = detail.FoundationCondition,
                FloorStructure         = detail.FloorStructure,
                FloorCondition         = detail.FloorCondition,
                ExteriorWalls          = detail.ExteriorWalls,
                WallCondition          = detail.WallCondition,
                RoofFraming            = detail.RoofFraming,
                RoofFrame              = detail.RoofFrame,
                RoofCover              = detail.RoofCover,
                RoofCondition          = detail.RoofCondition,
                ChimneyType            = detail.ChimneyType,
                ChimneyCondition       = detail.ChimneyCondition,
                RoofDrainage           = detail.RoofDrainage,
                DrainageCondition      = detail.DrainageCondition,
                WallCover              = detail.WallCover,
                WallCovers             = detail.WallCovers,
                EavesSoffitsFascia     = detail.EavesSoffitsFascia,
                EavesSoffitsAndFascia  = detail.EavesSoffitsAndFascia,
                ExteriorDoors          = detail.ExteriorDoors,
                ExtDoorCondition       = detail.ExtDoorCondition,
                Driveways              = detail.Driveways,
                DriveCondition         = detail.DriveCondition,
                Walkways               = detail.Walkways,
                WalkCondition          = detail.WalkCondition,
                GarageDoors            = detail.GarageDoors,
                GarageDoorCond         = detail.GarageDoorCond,
                PorchAndPatio          = detail.PorchAndPatio,
                PorchCondition         = detail.PorchCondition,
                SurfaceDrainage        = detail.SurfaceDrainage,
                SurfaceDrainCondition  = detail.SurfaceDrainCondition,
                RetainingWall          = detail.RetainingWall,
                RetainingWallCondition = detail.RetainingWallCondition,
                Fencing                = detail.Fencing,
                FenceCondition         = detail.FenceCondition
            };

            return(View(model));
        }
Example #3
0
        public bool UpdateExComponent(ExComponentEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .ExComponents
                    .Single(e => e.ExterId == model.ExterId);

                entity.Foundation            = model.Foundation;
                entity.FoundationCondition   = model.FoundationCondition;
                entity.FloorStructure        = model.FloorStructure;
                entity.FloorCondition        = model.FloorCondition;
                entity.ExteriorWalls         = model.ExteriorWalls;
                entity.WallCondition         = model.WallCondition;
                entity.RoofFraming           = model.RoofFraming;
                entity.RoofFrame             = model.RoofFrame;
                entity.RoofCover             = model.RoofCover;
                entity.RoofCondition         = model.RoofCondition;
                entity.ChimneyType           = model.ChimneyType;
                entity.ChimneyCondition      = model.ChimneyCondition;
                entity.RoofDrainage          = model.RoofDrainage;
                entity.DrainageCondition     = model.DrainageCondition;
                entity.WallCover             = model.WallCover;
                entity.WallCovers            = model.WallCovers;
                entity.EavesSoffitsFascia    = model.EavesSoffitsFascia;
                entity.EavesSoffitsAndFascia = model.EavesSoffitsAndFascia;
                entity.ExteriorDoors         = model.ExteriorDoors;
                entity.ExtDoorCondition      = model.ExtDoorCondition;
                entity.Driveways             = model.Driveways;
                entity.DriveCondition        = model.DriveCondition;
                entity.Walkways               = model.Walkways;
                entity.WalkCondition          = model.WalkCondition;
                entity.GarageDoors            = model.GarageDoors;
                entity.GarageDoorCond         = model.GarageDoorCond;
                entity.PorchAndPatio          = model.PorchAndPatio;
                entity.PorchCondition         = model.PorchCondition;
                entity.SurfaceDrainage        = model.SurfaceDrainage;
                entity.SurfaceDrainCondition  = model.SurfaceDrainCondition;
                entity.RetainingWall          = model.RetainingWall;
                entity.RetainingWallCondition = model.RetainingWallCondition;
                entity.Fencing        = model.Fencing;
                entity.FenceCondition = model.FenceCondition;

                return(ctx.SaveChanges() == 1);
            }
        }
Example #4
0
 public bool UpdateExComponents(ExComponentEdit model)
 {
     throw new NotImplementedException();
 }