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(); } }
public object Post(SayWhat request) { if (_sayWhatRepository.Exists(request.Quote)) { return new SayWhatResult {Status = "exists"}; } _sayWhatRepository.Add(request); return new SayWhatResult { Status = "ok" }; }
public object Get(SayWhat request) { var sayWhat = _sayWhatRepository.Random(); return sayWhat ?? new SayWhat() {Quote = "o_O"}; }