Пример #1
0
 public void Add(SayWhat request)
 {
     using (var session = new DocumentStore { Url = ConfigurationManager.AppSettings["RavenUrl"].ToString(), ApiKey = ConfigurationManager.AppSettings["RavenApiKey"].ToString() }.Initialize().OpenSession())
     {
         session.Store(request);
         session.SaveChanges();
     }
 }
Пример #2
0
 public object Post(SayWhat request)
 {
     if (_sayWhatRepository.Exists(request.Quote))
     {
         return new SayWhatResult {Status = "exists"};
     }
     _sayWhatRepository.Add(request);
     return new SayWhatResult { Status = "ok" };
 }
Пример #3
0
 public object Get(SayWhat request)
 {
     var sayWhat = _sayWhatRepository.Random();
     return sayWhat ?? new SayWhat() {Quote = "o_O"};
 }