Ejemplo n.º 1
0
 public void AddPhoto(Photo photo)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.PhotoSet.Add(photo);
         ctx.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void AddEvent(Event myEvent)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.EventSet.Add(myEvent);
         ctx.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void AddPerson(Person person)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.PersonSet.Add(person);
         ctx.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public void AddLandScape(LandScape landscape)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.LandScapeSet.Add(landscape);
         ctx.SaveChanges();
     }
 }
Ejemplo n.º 5
0
 public void AddLocation(Location location)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.LocationSet.Add(location);
         ctx.SaveChanges();
     }
 }
Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 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);
         }
     }
 }