Пример #1
0
 public IHttpActionResult CreateKeyWordPair(KeyWordPair kwp)
 {
     kwp.Key = Guid.NewGuid().ToString("n").Substring(0, 15);
     GWTDbContext.GetSingletonInstance().KeyWordPairs.Add(kwp);
     GWTDbContext.GetSingletonInstance().SaveChanges();
     return(Created(new Uri(Request.RequestUri + "/" + kwp.Key), kwp));
 }
Пример #2
0
        public IHttpActionResult Get(string gamekey)
        {
            KeyWordPair kwp = GWTDbContext.GetSingletonInstance().KeyWordPairs.SingleOrDefault(k => k.Key == gamekey);

            if (kwp == null)
            {
                return(NotFound());
            }
            return(Ok(kwp.Word));
        }