public List <Information> GetAllRecords([FromUri] EditorViewModel model) { IMongoDAL dal = new MongoDAL(); var result = dal.GetInformation(model.Country, model.State, model.City, model.Category, model.SubCategory); List <Information> response = new List <Information>(); foreach (var item in result) { response.Add(new Information { Id = item["_id"].ToString(), Descrption = item["Description"].ToString(), Likes = Convert.ToInt32(item["Likes"].ToString()) }); } return(response); }
public List <Information> GetAllRecords([FromUri] CategoryModel model) { IMongoDAL dal = new MongoDAL(); var result = dal.GetInformation(model.Country, model.State, model.City, model.Category, model.SubCategory); var response = new List <Information>(); if (result.Any()) { foreach (var item in result) { var responseItem = new Information(); responseItem.Likes = item["Likes"].ToString(); responseItem.Description = item["Description"].ToString(); responseItem.PostDate = item["PostDate"].ToString(); responseItem.Id = item["_id"].ToString(); response.Add(responseItem); } } return(response); }