Exemplo n.º 1
0
 public int GetIdByName(string name)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var id = from p in ctx.PersonSet where (p.FirstName == name) select p.Id;
         return((int)(id.FirstOrDefault()));
     }
 }
Exemplo n.º 2
0
 public Photo GetPhotoById(int id)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var photo = from p in ctx.PhotoSet where (p.Id == id) select p;
         return(photo.FirstOrDefault());
     }
 }
Exemplo n.º 3
0
 public bool DeletePhoto(int id)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.Database.ExecuteSqlCommand("Delete From Photos where Id =@p0", id);
         return(true);
     }
 }
Exemplo n.º 4
0
 public void AddLandScape(LandScape landscape)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.LandScapeSet.Add(landscape);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public int GetIdByName(string name)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var id = from l in ctx.LandScapeSet where (l.LandScapeName == name) select l.Id;
         return((int)(id.FirstOrDefault()));
     }
 }
Exemplo n.º 6
0
 public Location GetLocationById(int id)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var locations = from l in ctx.LocationSet where (l.Id == id) select l;
         return(locations.FirstOrDefault());
     }
 }
Exemplo n.º 7
0
 public void AddEvent(Event myEvent)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.EventSet.Add(myEvent);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 8
0
 public void AddLocation(Location location)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.LocationSet.Add(location);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 9
0
 public Event GetEventById(int id)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var myEvent = from e in ctx.EventSet where (e.Id == id) select e;
         return(myEvent.FirstOrDefault());
     }
 }
Exemplo n.º 10
0
 public void AddPerson(Person person)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.PersonSet.Add(person);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 11
0
 public Person GetPersonById(int id)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var people = from l in ctx.PersonSet where (l.Id == id) select l;
         return(people.FirstOrDefault());
     }
 }
Exemplo n.º 12
0
 public LandScape GetLandScapeById(int id)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var landScape = from l in ctx.LandScapeSet where (l.Id == id) select l;
         return(landScape.FirstOrDefault());
     }
 }
Exemplo n.º 13
0
 public int GetIdByName(string name)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var id = from e in ctx.EventSet where (e.EventName == name) select e.Id;
         return((int)(id.FirstOrDefault()));
     }
 }
Exemplo n.º 14
0
 public void AddPhoto(Photo photo)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         ctx.PhotoSet.Add(photo);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 15
0
 public List <LandScape> GetLandScapes()
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var landScapes = from l in ctx.LandScapeSet select l;
         if (landScapes != null)
         {
             return(landScapes.ToList());
         }
         return(null);
     }
 }
Exemplo n.º 16
0
 public List <Person> GetPeople()
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var people = from l in ctx.PersonSet select l;
         if (people != null)
         {
             return(people.ToList());
         }
         return(null);
     }
 }
Exemplo n.º 17
0
 public List <Location> GetLocation()
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var locations = from l in ctx.LocationSet select l;
         if (locations != null)
         {
             return(locations.ToList());
         }
         return(null);
     }
 }
Exemplo n.º 18
0
 public Person GetPersonByName(string name)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var person = from p in ctx.PersonSet where (p.FirstName == name) select p;
         if (person != null)
         {
             return(person.FirstOrDefault());
         }
         return(null);
     }
 }
Exemplo n.º 19
0
 public LandScape GetLandScapeByName(string name)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var landScape = from l in ctx.LandScapeSet where (l.LandScapeName == name) select l;
         if (landScape != null)
         {
             return(landScape.SingleOrDefault());
         }
         return(null);
     }
 }
Exemplo n.º 20
0
 public Location GetLocationByName(string name)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var location = from l in ctx.LocationSet where (l.LocationName == name) select l;
         if (location != null)
         {
             return(location.SingleOrDefault());
         }
         return(null);
     }
 }
Exemplo n.º 21
0
 public List <Event> GetEvents()
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var myevents = from e in ctx.EventSet select e;
         if (myevents != null)
         {
             return(myevents.ToList());
         }
         return(null);
     }
 }
Exemplo n.º 22
0
 public List <Photo> GetPhoto()
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var photos = from p in ctx.PhotoSet select p;
         if (photos != null)
         {
             return(photos.ToList());
         }
         return(null);
     }
 }
Exemplo n.º 23
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();
         }
     }
 }
Exemplo n.º 24
0
 public Event GetEventByName(string name)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var myevent = from e in ctx.EventSet where (e.EventName == name) select e;
         if (myevent != null)
         {
             return(myevent.SingleOrDefault());
         }
         return(null);
     }
 }
Exemplo n.º 25
0
        public List <String> GetLandScapeName()
        {
            List <string> landscapeName = new List <string>();

            using (PhotoContainer ctx = new PhotoContainer())
            {
                var landscapes = from l in ctx.LandScapeSet select l.LandScapeName;
                if (landscapes != null)
                {
                    landscapeName = landscapes.ToList();
                }
                return(landscapeName);
            }
        }
Exemplo n.º 26
0
 public bool UpdateLandScape(int id, string landscapeName, string landscapeDescription)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var result = ctx.LandScapeSet.SingleOrDefault(l => l.Id == id);
         if (result != null)
         {
             result.LandScapeName        = landscapeName;
             result.LandScapeDescription = landscapeDescription;
             return(true);
         }
         return(false);
     }
 }
Exemplo n.º 27
0
        public List <String> GetLocationsName()
        {
            List <string> locationsName = new List <string>();

            using (PhotoContainer ctx = new PhotoContainer())
            {
                var locations = from l in ctx.LocationSet select l.LocationName;
                if (locations != null)
                {
                    locationsName = locations.ToList();
                }
                return(locationsName);
            }
        }
Exemplo n.º 28
0
        public List <String> GetEventsName()
        {
            List <string> eventsName = new List <string>();

            using (PhotoContainer ctx = new PhotoContainer())
            {
                var events = (from e in ctx.EventSet select e.EventName);
                if (events != null)
                {
                    eventsName = events.ToList();
                }
                return(eventsName);
            }
        }
Exemplo n.º 29
0
 public bool updatePerson(int id, string FirstName, string LastName, string Age)
 {
     using (PhotoContainer ctx = new PhotoContainer())
     {
         var result = ctx.PersonSet.SingleOrDefault(p => p.Id == id);
         if (result != null)
         {
             result.FirstName = FirstName;
             result.LastName  = LastName;
             result.Age       = Age;
             return(true);
         }
         return(false);
     }
 }
Exemplo n.º 30
0
        public List <Photo> GetPhoto(int LocationId, int LandScapeId, int PersonId, int EventId)
        {
            List <Photo> photos;

            using (PhotoContainer ctx = new PhotoContainer())
            {
                var queryable = ctx.PhotoSet
                                .Where(x => x.EventId == EventId && EventId != 0)
                                .Where(x => x.LocationId == LocationId && LocationId != 0)
                                .Where(x => x.LandScapeId == LandScapeId && LandScapeId != 0)
                                .Where(x => x.PersonId == PersonId && PersonId != 0);
                photos = queryable.ToList();
            }
            return(photos);
        }