Пример #1
0
        public IHttpActionResult Get(int id)
        {
            DataSet data = new DataSet();
            Bookmark bookmark = new Bookmark();
            data = Data.BookmarkAccess.SelectOneBookmark(id);
            bookmark.ID = Int32.Parse(data.Tables[0].Rows[0][0].ToString());
            bookmark.Title = data.Tables[0].Rows[0][1].ToString();
            bookmark.Url = data.Tables[0].Rows[0][2].ToString();
            bookmark.User = data.Tables[0].Rows[0][3].ToString();
            bookmark.Date = DateTime.Parse(data.Tables[0].Rows[0][4].ToString());

            return Ok(bookmark);
        }
Пример #2
0
        public IHttpActionResult Get()
        {
            DataSet data = new DataSet();
            Bookmark bookmark = new Bookmark();
            List<Bookmark> bookmarkList = new List<Bookmark>();
            data = Data.BookmarkAccess.SelectBookmarks();
            foreach (DataRow x in data.Tables[0].Rows)
            {
                bookmark = new Bookmark();
                bookmark.ID = Int32.Parse(x[0].ToString());
                bookmark.Title = x[1].ToString();
                bookmark.Url = x[2].ToString();
                bookmark.User = x[3].ToString();
                bookmark.Date = DateTime.Parse(x[4].ToString());
                bookmarkList.Add(bookmark);

            }
            return Ok(bookmarkList);
        }