public ActionResult Edit(int id)
        {
            var service = CreateDecalService();
            var detail  = service.GetDecalById(id);
            var model   =
                new DecalEdit
            {
                DecalID     = detail.DecalID,
                DecalName   = detail.DecalName,
                DecalColor  = detail.DecalColor,
                DecalRarity = detail.DecalRarity,
            };

            return(View(model));
        }
        public bool UpdateDecal(DecalEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Decals
                    .Single(e => e.DecalID == model.DecalID && e.OwnerID == _userID);

                entity.DecalID     = model.DecalID;
                entity.DecalName   = model.DecalName;
                entity.DecalColor  = model.DecalColor;
                entity.DecalRarity = model.DecalRarity;

                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Edit(int id, DecalEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

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

            var service = CreateDecalService();

            if (service.UpdateDecal(model))
            {
                TempData["SaveResult"] = "Your decal was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your decal could not be updated.");
            return(View(model));
        }