コード例 #1
0
 public ActionResult Edit(Bill model)
 {
     if (ModelState.IsValid)
     {
         _service.Update(model);
     }
     return RedirectToAction("Index");
 }
コード例 #2
0
 public ActionResult Create(Bill model)
 {
     if (ModelState.IsValid)
     {
         _service.Add(model);
     }
     return RedirectToAction("Index");
 }
コード例 #3
0
        public void AddBill_Succcess()
        {
            var repo = new Mock<IGenericRepository>();

            var newBill = new Bill()
            {
                Name = "Lee"
            };

            repo.Setup(x => x.Create<Bill>(It.IsAny<Bill>())).Verifiable();

            var service = new BillService(repo.Object);

            service.Add(newBill);

            repo.Verify();
        }