Beispiel #1
0
 public void AddPhoto(Photo photo)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.PhotoSet.Add(photo);
         ctx.SaveChanges();
     }
 }
Beispiel #2
0
 public void AddEvent(Event myEvent)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.EventSet.Add(myEvent);
         ctx.SaveChanges();
     }
 }
Beispiel #3
0
 public void AddPerson(Person person)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.PersonSet.Add(person);
         ctx.SaveChanges();
     }
 }
Beispiel #4
0
 public void AddLandScape(LandScape landscape)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.LandScapeSet.Add(landscape);
         ctx.SaveChanges();
     }
 }
Beispiel #5
0
 public void AddLocation(Location location)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.LocationSet.Add(location);
         ctx.SaveChanges();
     }
 }
Beispiel #6
0
 public void UpdateIsRemoved(Photo photo)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var result = ctx.PhotoSet.SingleOrDefault(p => p.Id == photo.Id);
         if (result != null)
         {
             result.isRemoved = "true";
             ctx.SaveChanges();
         }
     }
 }
Beispiel #7
0
 public bool UpdatePhoto(Photo photo, int @eventId, int landScapeId, int personId, int locationId)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var result = ctx.PhotoSet.SingleOrDefault(p => p.Id == photo.Id);
         if (result != null)
         {
             result.LandScapeId = landScapeId;
             result.LocationId  = locationId;
             result.EventId     = @eventId;
             result.PersonId    = personId;
             ctx.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }