示例#1
0
        public IEnumerable <PersonVM> GetAllFriendsForUser(string username = "******")
        {
            var context = new hackathon_shift_2016_testEntities();
            var id      = context.Person.Single(_person => _person.Username == username).Id;

            //context.Dispose();

            context = new hackathon_shift_2016_testEntities();
            var friends = context.PersonSubscription.Where(_person => _person.SubscriberID == id);
            //context.Dispose();

            var viewModels = new List <PersonVM>();

            foreach (var friend in friends)
            {
                context = new hackathon_shift_2016_testEntities();
                var _person = context.Person.SingleOrDefault(person => person.Id == friend.Id);
                if (_person != null)
                {
                    viewModels.Add(PersonMapper.Map(_person));
                }
                //context.Dispose();
            }

            return(viewModels);
        }
示例#2
0
        public IEnumerable <PersonVM> GetAllPeople()
        {
            var context = new hackathon_shift_2016_testEntities();

            return(context.Person.Select(e => new PersonVM()
            {
                Id = e.Id,
                FirstName = e.FirstName,
                ImageUrl = e.ImageUrl,
                LastName = e.LastName,
                BirthDate = e.BirthDate,
                Username = e.Username,
                Email = e.Email,
                Rating = e.Rating
            }));
        }
示例#3
0
 public LoginAPIController()
 {
     context = new hackathon_shift_2016_testEntities();
 }
示例#4
0
 public TownApiController()
 {
     context = new hackathon_shift_2016_testEntities();
 }
示例#5
0
 public UserApiController()
 {
     context = new hackathon_shift_2016_testEntities();
     currentlyLoggedInUserId = 14;
 }