Esempio n. 1
0
 public async Task<Response<SpeakersRetreiveResponse>> RetreivePersonAsync(RetreivePersonSpeakerRequest request)
 {
     return await _factory.ProcessRequestAsync(async () =>
     {
         using (var uow = new CodeCamperUnitOfWork())
         {
             var person = await uow.PersonsRepository.FindByAsync(request.Id);
             IList<SpeakersSession> sessions = (from s in await uow.SessionsRepository.FindByPersonAsync(person)
                 select new SpeakersSession
                 {
                     Id = s.Id, 
                     Title = s.Title, 
                     From = s.TimeSlot.Start.ToString("ddd hh:mm tt")
                 }).ToList();
             return new SpeakersRetreiveResponse
             {
                 Id = person.Id,
                 FullName = string.Concat(person.FirstName, " ", person.LastName),
                 ImageSource = string.Concat(ServiceConfigManager.Config.ImageUrl, person.ImageSource),
                 Email = person.Email,
                 Blog = person.Blog,
                 Twitter = person.Twitter,
                 Bio = person.Bio,
                 Sessions = sessions,
                 AvgRating = await uow.PersonsRepository.GetAvgRatingAsync(request.Id)
             };
         }
     });
 }
Esempio n. 2
0
 public static string BuildDataScript()
 {
     string result = "define({data:";
     using (var uow = new CodeCamperUnitOfWork())
     {
         result = string.Concat(result,
             JsonConvert.SerializeObject(uow.SessionsRepository.GetTagCounts()));
     }
     return string.Concat(result, "});");
 }
Esempio n. 3
0
 public async Task<Response> RateSpeakerAsync(RateSpeakerRequest request)
 {
     return await _factory.ProcessRequestAsync<Response>(async () =>
     {
         request.UserId = Guid.Parse(HttpContext.Current.User.Identity.Name);
         using (var uow = new CodeCamperUnitOfWork())
         {
             await uow.PersonsRepository.RateAsync(request.UserId, request.Id, request.Rating);
             await uow.CommitAsync();
         }
     });
 }
        public void TestMethod1()
        {
            using (var uow = new CodeCamperUnitOfWork())
            {
                List<int> tracks = new List<int> { 2, 4 };
                List<string> tags = new List<string> { "Web", "JavaScript" };
                var x = uow.SessionsRepository.SearchAsync("pirate", tracks, tags);
                x.Wait();

                Log.Info(x.Result.Count);
                Log.Info(uow.GetSql());
            }
        }
Esempio n. 5
0
        public async Task<Response<IEnumerable<SessionRetreiveAllResponse>>> RetreiveSessionsAsync(RetreiveAllSessionRequest request)
        {
            return await _factory.ProcessRequestAsync(async () =>
            {
                using (var uow = new CodeCamperUnitOfWork())
                {
                    /*
                    var sessions = uow.SessionsRepository.FindAll();

                    if (!string.IsNullOrEmpty(request.FilterExpression))                    
                        sessions = sessions.Where(s => s.Title.Contains(request.FilterExpression))                    
                     * */

                    return new List<SessionRetreiveAllResponse>() as IEnumerable<SessionRetreiveAllResponse>;
                }               
            });
        }
Esempio n. 6
0
 public async Task<Response<IEnumerable<SpeakersRetreiveAllResponse>>> RetreiveAllAsync(RetreiveAllSpeakerRequest request)
 {
     return await _factory.ProcessRequestAsync(async () =>
     {
         using (var uow = new CodeCamperUnitOfWork())
         {
             var speakers = await uow.PersonsRepository.GetPersonsAsync();
             return speakers.OrderBy(s => s.FirstName).Select(s =>
                 new SpeakersRetreiveAllResponse
                 {
                     Id = s.Id,
                     FirstName = s.FirstName.ToUpper(),
                     LastName = s.LastName.ToUpper(),
                     ImageSource = string.Concat(ServiceConfigManager.Config.ImageUrl, s.ImageSource),
                 });
         }               
     });
 }