コード例 #1
0
 public StoreLocationView GetById(int id)
 {
     using (var repo = new StoreLocationRepository())
     {
         return GetAllLocations().Find(x => x.LocationId == id);
     }
 }
コード例 #2
0
 public void Dispose(bool disposing)
 {
     using (var repo = new StoreLocationRepository())
     {
         repo.Dispose();
     }
 }
コード例 #3
0
 public void Delete(StoreLocationView storeLocationModel)
 {
     using (var repo = new StoreLocationRepository())
     {
         var dis = new StoreLocation();
         dis = repo.GetById(storeLocationModel.LocationId);
         repo.Delete(dis);
     }
 }
コード例 #4
0
 public List<StoreLocationView> GetAllLocations()
 {
     using (var locationrepo = new StoreLocationRepository())
     {
         return locationrepo.GetAll().Select(x => new StoreLocationView()
         {
             LocationId = x.LocationId,
             Description = x.Description,
             OpHours = x.OpHours,
             Address = x.Address,
             Contact = x.Contact
         }).ToList();
     }
 }
コード例 #5
0
        public void Insert(StoreLocationView storeLocationModel)
        {
            using (var repo = new StoreLocationRepository())
            {
                var dis = new StoreLocation();
                if (true)
                {
                    dis.LocationId = storeLocationModel.LocationId;
                    dis.Description = storeLocationModel.Description;
                    dis.OpHours = storeLocationModel.OpHours;
                    dis.Address = storeLocationModel.Address;
                    dis.Contact = storeLocationModel.Contact;

                }
                repo.Insert(dis);
            }
        }
コード例 #6
0
        public void Update(StoreLocationView storeLocationModel)
        {
            using (var repo = new StoreLocationRepository())
            {
                var dis = new StoreLocation();
                dis = repo.GetById(storeLocationModel.LocationId);
                if (true)
                {

                    dis.Description = storeLocationModel.Description;
                    dis.OpHours = storeLocationModel.OpHours;
                    dis.Address = storeLocationModel.Address;
                    dis.Contact = storeLocationModel.Contact;

                }
                repo.Update(dis);

            }
        }