예제 #1
0
        public HttpResponseMessage<News> PostNews(News news, HttpRequestMessage<News> request)
        {
            if (news.EarthwatcherId != 0 && news.NewsItem!= String.Empty)
                newsRepository.PostNews(news);

            return null;
        }
예제 #2
0
 public News PostNews(News news)
 {
     connection.Open();
     var cmd = connection.CreateCommand() as SqlCommand;
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.CommandText = "News_PostNews";
     
     cmd.Parameters.Add(new SqlParameter("@userid", news.EarthwatcherId));
     cmd.Parameters.Add(new SqlParameter("@NewsItem", news.NewsItem));
     cmd.Parameters.Add(new SqlParameter("@Published", DateTime.Now.ToUniversalTime()));
     cmd.Parameters.Add(new SqlParameter("@shape", SqlGeography.STGeomFromText(new SqlChars(news.Wkt), 4326)) { UdtTypeName = "Geography" });
     var idParameter = new SqlParameter("@ID", SqlDbType.Int) {Direction = ParameterDirection.Output};
     cmd.Parameters.Add(idParameter);
     cmd.ExecuteNonQuery();
     connection.Close();
     return news;
 }
예제 #3
0
 public NewsControl(News news)
 {
     InitializeComponent();
     this.news = news;
     Init();
 }