Ejemplo n.º 1
0
 List<UserModel> getUsersByCategoryFromDatabase()
 {
     List<UserModel> list_user=new List<UserModel>();
     for (int i = 0; i < categoryCount; i++)
     {
         if (category[i])
         {
             List<ItemTable> list = db.Items.Where(c => c.CategoryId == i + 1).ToList<ItemTable>();
             foreach (ItemTable item in list)
             {
                 UserTable user = db.Users.First(c => c.Id == item.UserId);
                 UserModel userModel = new UserModel()
                 {
                     AvatarUri = user.AvatarUri,
                     UserName = user.UserName,
                     Latitude=(double)user.Latitude,
                     Longitude = (double)user.Longitude,
                     Category = i,
                     Id=user.Id,
                     Address=user.Address
                 };
                // Geocode(userModel.Address,user.Id);
                 if (!list_user.Any(c => c.Id == user.Id))
                     list_user.Add(userModel);
             }
         }
     }
     return list_user;
 }
Ejemplo n.º 2
0
 public List<UserModel> getChooseUser(ObservableCollection<RecyclePlanModel> listPlanModel)
  {
    List<UserModel> list = new List<UserModel>(); ;
    foreach(RecyclePlanModel moel in listPlanModel)
       {
        UserTable user = db.Users.First(c => c.Id == moel.UserId);
            UserModel userModel = new UserModel()
                 {
                     AvatarUri = user.AvatarUri,
                     UserName = user.UserName,
                     Latitude=(double)user.Latitude,
                     Longitude = (double)user.Longitude,
                     //Category = i,
                     Id=user.Id,
                     Address=user.Address
                 };
                 list.Add(userModel);
       }
    return list;
  }