public bool Update(Village village,int id)
        {
            var element= villageCollection.Where(x => x.Id == village.Id).FirstOrDefault();

            return true;
            
        }
示例#2
0
 public void Update()
 {
     var village = new Village
     {
         Id = 200,
         Name = "Octupus",
         Film = "Spiderman 2"
     };
     Assert.IsTrue(service.Update(village,200));
 }
示例#3
0
 public void Insert()
 {
     var village = new Village
     {
         Id = 200,
         Name = "Octupus",
         Film = "Spiderman 2"
     };
     Assert.IsTrue(service.Insert(village));
 }
 public bool UpdateTest(
     [PexAssumeUnderTest]VillageServiceMock target,
     Village village,
     int id
 )
 {
     bool result = target.Update(village, id);
     return result;
     // TODO: add assertions to method VillageServiceMockTest.UpdateTest(VillageServiceMock, Village, Int32)
 }
示例#5
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var village = new Village
                {
                    Film = collection["Film"].ToString(),
                    Name = collection["Name"].ToString(),
                    Photo = collection["Photo"].ToString()
                };

                service.Insert(village);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
示例#6
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                var village = new Village
                {
                    Film = collection["Film"].ToString(),
                    Name = collection["Name"].ToString(),
                    Photo = collection["Photo"].ToString()
                };

                service.Update(village,id);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
 public bool Insert(Village village)
 {
     villageCollection.Add(village);
     return true;
 }
 public bool InsertTest([PexAssumeUnderTest]VillageServiceMock target, Village village)
 {
     bool result = target.Insert(village);
     return result;
     // TODO: add assertions to method VillageServiceMockTest.InsertTest(VillageServiceMock, Village)
 }