Exemple #1
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();
     }
 }
Exemple #2
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);
        }
Exemple #3
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);
        }
Exemple #4
0
 public void InsertLocationInLibrary(LocationInLibraryModel locationInLibraryModel)
 {
     locationInLibraryModel.IDLocationInLibrary = Guid.NewGuid();
     booksLibraryDataContext.LocationInLibraries.InsertOnSubmit(MapModelToDbObject(locationInLibraryModel));
     booksLibraryDataContext.SubmitChanges();
 }