Ejemplo n.º 1
0
        public HttpResponseMessage<JaguarGame> Post(JaguarGame jaguarPos, HttpRequestMessage<JaguarGame> request)
        {
            if (jaguarPos != null)
            {
                var jaguarDB = jaguarRepository.Insert(jaguarPos);

                var response = new HttpResponseMessage<JaguarGame>(jaguarDB) { StatusCode = HttpStatusCode.Created };
                return response;
            }
            return new HttpResponseMessage<JaguarGame>(null) { StatusCode = HttpStatusCode.NotFound, };
        }
Ejemplo n.º 2
0
 public JaguarGame Insert(JaguarGame jaguarPos)
 {
     try
     {
         connection.Open();
         var cmd = connection.CreateCommand() as SqlCommand;
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.CommandText = "Jaguar_Insert";
         cmd.Parameters.Add(new SqlParameter("@day", jaguarPos.Day));
         cmd.Parameters.Add(new SqlParameter("@hour", jaguarPos.Hour));
         cmd.Parameters.Add(new SqlParameter("@minutes", jaguarPos.Minutes));
         cmd.Parameters.Add(new SqlParameter("@longitude", jaguarPos.Longitude));
         cmd.Parameters.Add(new SqlParameter("@latitude", jaguarPos.Latitude));
         var idParameter = new SqlParameter("@ID", SqlDbType.Int) { Direction = ParameterDirection.Output };
         cmd.Parameters.Add(idParameter);
         cmd.ExecuteNonQuery();
         connection.Close();
         return jaguarPos;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }