public void Edit(AppearanceEditBm bind)
        {
            var entity = this.appearances.GetById(bind.Id);

            entity.Name  = bind.Name;
            entity.Price = bind.Price;

            this.appearances.Update(entity);
            this.appearances.SaveChanges();
        }
        public ActionResult Edit(AppearanceEditBm bind)
        {
            if (this.ModelState.IsValid)
            {
                this.service.Edit(bind);
                return(this.RedirectToAction("PriceList", "Appearance", new { area = "" }));
            }

            var appearanceEditVm = this.service.GetAppearanceEditVm(bind.Id);

            return(this.View(appearanceEditVm));
        }
Beispiel #3
0
        public void EditPost_ShouldRedirect()
        {
            var bm = new AppearanceEditBm()
            {
                Id    = 1,
                Name  = "Kutiq",
                Price = 21.0m,
            };

            this._controller.WithCallTo(appContr => appContr.Edit(bm))
            .ShouldRedirectTo <AppearanceController>(c2 => c2.PriceList());
            var entity = this._repository.Set.FirstOrDefault(e => e.Id == bm.Id);

            if (entity == null)
            {
                return;
            }
            Assert.AreEqual(entity.Name, "Kutiq");
            Assert.AreEqual(entity.Price, 21.0m);
        }