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())); } }
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()); } }
public bool DeletePhoto(int id) { using (PhotoContainer ctx = new PhotoContainer()) { ctx.Database.ExecuteSqlCommand("Delete From Photos where Id =@p0", id); return(true); } }
public void AddLandScape(LandScape landscape) { using (PhotoContainer ctx = new PhotoContainer()) { ctx.LandScapeSet.Add(landscape); ctx.SaveChanges(); } }
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())); } }
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()); } }
public void AddEvent(Event myEvent) { using (PhotoContainer ctx = new PhotoContainer()) { ctx.EventSet.Add(myEvent); ctx.SaveChanges(); } }
public void AddLocation(Location location) { using (PhotoContainer ctx = new PhotoContainer()) { ctx.LocationSet.Add(location); ctx.SaveChanges(); } }
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()); } }
public void AddPerson(Person person) { using (PhotoContainer ctx = new PhotoContainer()) { ctx.PersonSet.Add(person); ctx.SaveChanges(); } }
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()); } }
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()); } }
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())); } }
public void AddPhoto(Photo photo) { using (PhotoContainer ctx = new PhotoContainer()) { ctx.PhotoSet.Add(photo); ctx.SaveChanges(); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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(); } } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); }