Compare commits

..

No commits in common. "ba00a6e35e6f8564ce22e52aaa9a2d99f01d5b29" and "bd486fa9f7e6b28f4ee088d6c955c1ac3eb1e181" have entirely different histories.

4 changed files with 4 additions and 7 deletions

View File

@ -20,7 +20,6 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "API_BASE_URL", project.property("API_BASE_URL").toString()) buildConfigField("String", "API_BASE_URL", project.property("API_BASE_URL").toString())
} }
buildTypes { buildTypes {

View File

@ -10,6 +10,7 @@ import android.view.ViewGroup
import android.widget.Button import android.widget.Button
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import tech.mercantec.easyeat.R import tech.mercantec.easyeat.R
import tech.mercantec.easyeat.helpers.ApiRequestException import tech.mercantec.easyeat.helpers.ApiRequestException
import tech.mercantec.easyeat.helpers.RecipeDetailsResponse import tech.mercantec.easyeat.helpers.RecipeDetailsResponse
@ -18,7 +19,6 @@ import kotlin.concurrent.thread
import android.widget.EditText import android.widget.EditText
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged import androidx.core.widget.doAfterTextChanged
import tech.mercantec.easyeat.helpers.AddRecipeToShoppingList import tech.mercantec.easyeat.helpers.AddRecipeToShoppingList
import tech.mercantec.easyeat.models.Ingredient import tech.mercantec.easyeat.models.Ingredient

View File

@ -111,15 +111,13 @@ namespace API.BusinessLogic
} }
// Adds an entire recipes ingredients to the shoppinglist // Adds an entire recipes ingredients to the shoppinglist
public async Task<IActionResult> AddRecipeToShoppingList(int userId, int recipeId, string multiplier) public async Task<IActionResult> AddRecipeToShoppingList(int userId, int recipeId, int multiplier)
{ {
var user = await _dbAccess.ReadShoppingList(userId); var user = await _dbAccess.ReadShoppingList(userId);
var recipe = await _recipeDBAccess.ReadRecipe(recipeId); var recipe = await _recipeDBAccess.ReadRecipe(recipeId);
var ingredients = recipe.Ingredients; var ingredients = recipe.Ingredients;
int multiToInt = int.Parse(multiplier); for (int i = 0; i < multiplier; i++)
for (int i = 0; i < multiToInt; i++)
{ {
foreach (var ingredient in ingredients) foreach (var ingredient in ingredients)
{ {

View File

@ -100,7 +100,7 @@ namespace API.Controllers
/// <returns>returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed</returns> /// <returns>returns a okobjectresult with a boolean that is true if it fails it returns a confliftobjectresult with a message of why it failed</returns>
[Authorize] [Authorize]
[HttpPost("recipeadd")] [HttpPost("recipeadd")]
public async Task<IActionResult> AddARecipesItems(int recipeId, string multiplier = "1") public async Task<IActionResult> AddARecipesItems(int recipeId, int multiplier = 1)
{ {
var claims = HttpContext.User.Claims; var claims = HttpContext.User.Claims;
string userIdString = claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value; string userIdString = claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;