Ejemplo n.º 1
0
        public HttpResponseMessage PostScore([FromBody] TriviaScoresAddRequest model)
        {
            model.AccountId = UserService.GetCurrentUser().Id;
            svc.Insert(model);
            SuccessResponse resp = new SuccessResponse();

            return(Request.CreateResponse(HttpStatusCode.OK, resp));
        }
Ejemplo n.º 2
0
 public void Insert(TriviaScoresAddRequest model)
 {
     using (SqlConnection conn = new SqlConnection(connStr))
     {
         string cmdStr = "TriviaScores_Insert";
         using (SqlCommand cmd = new SqlCommand(cmdStr, conn))
         {
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@AccountId", model.AccountId);
             cmd.Parameters.AddWithValue("@Correct", model.Correct);
             cmd.Parameters.AddWithValue("@Total", model.Total);
             cmd.Parameters.AddWithValue("@Category", model.Category);
             cmd.Parameters.AddWithValue("@Difficulty", model.Difficulty);
             conn.Open();
             cmd.ExecuteNonQuery();
             conn.Close();
         }
     }
 }