예제 #1
0
        public IActionResult ViewWShop(string wshopName)
        {
            //var wshopVM = new WShopVM { WShopName = wshopName };
            WShop wshop = repo.GetWShopByName(wshopName);

            return(View(wshop));
        }
예제 #2
0
        public IActionResult CreateWShop(WShop model)
        {
            model.Owner = userManager.GetUserAsync(User).Result;
            //model.TownLocation = userManager.GetUserAsync(User).Result.TownResidence;


            repo.AddWShop(model);

            return(RedirectToAction("Index", "WTown"));
        }
예제 #3
0
        public void GetByOwnerTest()
        {
            var fakeRepo = new FakeRepo();
            var wshop    = new WShop()
            {
                WShopName = "Name", Owner = new WCitizen()
                {
                    Name = "John", UserName = "******"
                }
            };

            fakeRepo.AddWShop(wshop);

            var retrievedWShop = fakeRepo.GetWShopByOwner("John");

            Assert.Equal(0, wshop.WShopName.CompareTo(retrievedWShop.WShopName));
        }
예제 #4
0
        public void AddWShopTest()
        {
            var fakeRepo = new FakeRepo();
            var wshop    = new WShop()
            {
                WShopName = "Name", Owner = new WCitizen()
                {
                    Name = "John", UserName = "******"
                }
            };

            fakeRepo.AddWShop(wshop);

            var retrievedWShop = fakeRepo.wshops.ToList()[0];

            Assert.Equal(0, wshop.WShopName.CompareTo(retrievedWShop.WShopName));
        }
예제 #5
0
 public void UpdateWShop(WShop wshop)
 {
     context.WShops.Update(wshop);
     context.SaveChanges();
 }
예제 #6
0
 public void AddWShop(WShop wshop)
 {
     context.WShops.Add(wshop);
     context.SaveChanges();
 }
예제 #7
0
 public void UpdateWShop(WShop wshop)
 {
     throw new NotImplementedException();
 }
예제 #8
0
 public void AddWShop(WShop wshop)
 {
     wshops.Add(wshop);
 }