Esempio n. 1
0
        private IList <NewsModel> PopulateNews(DataSet ds)
        {
            var models = new List <NewsModel>();

            if (ds != null)
            {
                foreach (DataRow rowItem in ds.Tables[0].Rows)
                {
                    var model = new NewsModel();
                    model.Content     = rowItem["Content"].ToString();
                    model.Id          = int.Parse(rowItem["Id"].ToString());
                    model.Title       = rowItem["Title"].ToString();
                    model.Category    = DataStorageService.FindCategoryById(int.Parse(rowItem["CategoryId"].ToString()));
                    model.DateCreated = DateTime.Parse(rowItem["DateCreated"].ToString());
                    model.DateUpdated = DateTime.Parse(rowItem["DateUpdated"].ToString());
                    models.Add(model);
                }
            }

            return(models);
        }
Esempio n. 2
0
 public override CategoryModel GetByKey(int key)
 {
     return(DataStorageService.FindCategoryById(key));
 }