コード例 #1
0
 public void DeleteLocationInLibrary(Guid ID)
 {
     Models.DBObjects.LocationInLibrary locationInLibraryToDelete = booksLibraryDataContext.LocationInLibraries.FirstOrDefault(x => x.IDLocationInLibrary == ID);
     if (locationInLibraryToDelete != null)
     {
         booksLibraryDataContext.LocationInLibraries.DeleteOnSubmit(locationInLibraryToDelete);
         booksLibraryDataContext.SubmitChanges();
     }
 }
コード例 #2
0
 public void UpdateLocationInLibrary(LocationInLibraryModel locationInLibraryModel)
 {
     Models.DBObjects.LocationInLibrary existingLocationInLibrary = booksLibraryDataContext.LocationInLibraries.FirstOrDefault(x => x.IDLocationInLibrary == locationInLibraryModel.IDLocationInLibrary);
     if (existingLocationInLibrary != null)
     {
         existingLocationInLibrary.IDLocationInLibrary = locationInLibraryModel.IDLocationInLibrary;
         existingLocationInLibrary.Name   = locationInLibraryModel.Name;
         existingLocationInLibrary.Floor  = locationInLibraryModel.Floor;
         existingLocationInLibrary.Sector = locationInLibraryModel.Sector;
         existingLocationInLibrary.Shelf  = locationInLibraryModel.Shelf;
         booksLibraryDataContext.SubmitChanges();
     }
 }
コード例 #3
0
        private Models.DBObjects.LocationInLibrary MapModelToDbObject(LocationInLibraryModel locationInLibraryModel)
        {
            Models.DBObjects.LocationInLibrary dbLocationInLibraryModel = new Models.DBObjects.LocationInLibrary();
            if (locationInLibraryModel != null)
            {
                dbLocationInLibraryModel.IDLocationInLibrary = locationInLibraryModel.IDLocationInLibrary;
                dbLocationInLibraryModel.Name   = locationInLibraryModel.Name;
                dbLocationInLibraryModel.Floor  = locationInLibraryModel.Floor;
                dbLocationInLibraryModel.Sector = locationInLibraryModel.Sector;
                dbLocationInLibraryModel.Shelf  = locationInLibraryModel.Shelf;

                return(dbLocationInLibraryModel);
            }
            return(null);
        }
コード例 #4
0
        private LocationInLibraryModel MapDbObjectToModel(Models.DBObjects.LocationInLibrary dbLocationInLibrary)
        {
            LocationInLibraryModel locationInLibraryModel = new LocationInLibraryModel();

            if (dbLocationInLibrary != null)
            {
                locationInLibraryModel.IDLocationInLibrary = dbLocationInLibrary.IDLocationInLibrary;
                locationInLibraryModel.Name   = dbLocationInLibrary.Name;
                locationInLibraryModel.Floor  = dbLocationInLibrary.Floor;
                locationInLibraryModel.Sector = dbLocationInLibrary.Sector;
                locationInLibraryModel.Shelf  = dbLocationInLibrary.Shelf;

                return(locationInLibraryModel);
            }
            return(null);
        }