|
|
|
@ -72,6 +72,18 @@ namespace LocalEndpoint.Data
|
|
|
|
|
return usersData[user].Rates[recipe];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void InsertInUserList(Guid userId, Guid recipeId, uint persAmount)
|
|
|
|
|
{
|
|
|
|
|
usersData[userId].RecipesList[recipeId] = persAmount;
|
|
|
|
|
Save(USERS_FILENAME, USERS_SERIALIZER, usersData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveFromUserList(Guid userId, Guid recipeId)
|
|
|
|
|
{
|
|
|
|
|
usersData[userId].RecipesList.Remove(recipeId);
|
|
|
|
|
Save(USERS_FILENAME, USERS_SERIALIZER, usersData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void InsertRecipe(Recipe recipe)
|
|
|
|
|
{
|
|
|
|
@ -81,7 +93,7 @@ namespace LocalEndpoint.Data
|
|
|
|
|
|
|
|
|
|
public void InsertUser(User user)
|
|
|
|
|
{
|
|
|
|
|
usersData[user.Id] = new UserData(user, new Dictionary<Guid, RecipeRate>());
|
|
|
|
|
usersData[user.Id] = new UserData(user, new Dictionary<Guid, RecipeRate>(), new Dictionary<Guid, uint>());
|
|
|
|
|
Save(USERS_FILENAME, USERS_SERIALIZER, usersData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -108,6 +120,11 @@ namespace LocalEndpoint.Data
|
|
|
|
|
return usersData[user].Rates.ToImmutableDictionary();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ImmutableDictionary<Guid, uint> GetRecipeListOf(Guid user)
|
|
|
|
|
{
|
|
|
|
|
return usersData[user].RecipesList.ToImmutableDictionary();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Recipe ConvertRecipeDataToRecipe(RecipeData rd)
|
|
|
|
|
{
|
|
|
|
|
var owner = usersData[rd.OwnerID].User;
|
|
|
|
|