public ActionResult Create(History history)
        {
            if (ModelState.IsValid)
            {
                db.History.Add(history);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(history);
        }
        // POST api/History
        public HttpResponseMessage PostHistory(CompletedGame game)
        {
            History history = new History();
            history.Score = game.Score;
            history.Game = db.Games.SingleOrDefault(g => g.Name == game.GameName);
            history.User = db.Users.SingleOrDefault(u => u.UserName == game.UserName);
            history.Date = DateTime.Now;

            //TODO: Validate History not game
            if (ModelState.IsValid)
            {
                db.History.Add(history);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, history);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = history.id }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
        // PUT api/History/5
        public HttpResponseMessage PutHistory(int id, History history)
        {
            if (ModelState.IsValid && id == history.id)
            {
                db.Entry(history).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return Request.CreateResponse(HttpStatusCode.NotFound);
                }

                return Request.CreateResponse(HttpStatusCode.OK);
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
 public ActionResult Edit(History history)
 {
     if (ModelState.IsValid)
     {
         db.Entry(history).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(history);
 }