示例#1
0
        public async Task <ActionResult> Edit(BreakModel model)
        {
            if (ModelState.IsValid)
            {
                BreakDataAccess breakDataAccess = new BreakDataAccess();
                breakDataAccess.Update(model);

                return(RedirectToAction("List", "Break"));

                //AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
示例#2
0
        public void EditTest()
        {
            BreakDataAccess   breakDataAccess = new BreakDataAccess();
            List <BreakModel> breakList       = breakDataAccess.List();

            // This method will be executed after the CreateTest, so items should exist
            if (breakList == null || breakList.Count == 0)
            {
                Assert.Fail();
            }

            string newName = "New Name";

            BreakModel model = breakList[0];

            model.Name = newName;

            breakDataAccess.Update(model);

            model = breakDataAccess.Read(model.Id);

            Assert.AreEqual(newName, model.Name);
        }