Exemplo n.º 1
0
        public JsonResult SavePlayer(Player player)
        {
            string playerId;
            try
            {
                var context = new CloudTableContext();
                playerId = context.SavePlayer((User)HttpContext.User.Identity, player);
            }
            catch (Exception exception)
            {
                //TODO:logging of exception!
                return Json(new { Success = false, ErrorMessage = exception.Message });
            }

            return Json(new { Success = true, Id = playerId });
        }
Exemplo n.º 2
0
        public JsonResult DeletePlayer(Player player)
        {
            try
            {
                var context = new CloudTableContext();
                context.DeletePlayer((User)HttpContext.User.Identity, player);
            }
            catch (Exception exception)
            {
                //TODO:logging of exception!
                //return new HttpResponseMessage(HttpStatusCode.InternalServerError);
                return Json(new { Success = false, ErrorMessage = exception.Message });
            }

            return Json(new { Success = true });
        }