Index: NutriMatch/Controllers/RecipesController.cs
===================================================================
--- NutriMatch/Controllers/RecipesController.cs	(revision 55a6d6698e060a0d4f1242a6790162878d7f3a29)
+++ NutriMatch/Controllers/RecipesController.cs	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
@@ -9,4 +9,6 @@
 using NutriMatch.Models;
 using System.Text.Json;
+using Microsoft.Identity.Client;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
 namespace NutriMatch.Controllers
 {
@@ -44,4 +46,18 @@
         public async Task<IActionResult> Create([Bind("Id,Title,Instructions")] Recipe recipe)
         {
+            float ConvertType(float number, string unit)
+            {
+                switch (unit.ToLower())
+                {
+                    case "g":
+                        return number / 100; 
+                    case "ml":
+                        return number / 100; 
+                    case "oz":
+                        return (float)(number * 28.3495 / 100); 
+                    default:
+                        return 0;
+                }
+            }
             if (ModelState.IsValid)
             {
@@ -50,14 +66,29 @@
                 string selectedIngredients = Request.Form["Ingredients"];
                 List<SelectedIngredient> ingredients = JsonSerializer.Deserialize<List<SelectedIngredient>>(selectedIngredients);
-                foreach(var i in ingredients)
-                { 
-                    _context.RecipeIngredients.Add(new RecipeIngredient {
+                float totalCalories = 0;
+                float totalProtein = 0;
+                float totalCarbs = 0;
+                float totalFat = 0;
+                foreach (var i in ingredients)
+                {
+                    _context.RecipeIngredients.Add(new RecipeIngredient
+                    {
                         RecipeId = recipe.Id,
                         IngredientId = i.Id,
                         Unit = i.Unit,
-                        Quantity = i.Quantity 
+                        Quantity = i.Quantity
                     });
-                }
-                await _context.SaveChangesAsync();
+                    Ingredient tempIngredient = _context.Ingredients.Find(i.Id);
+                    totalCalories += ConvertType(tempIngredient.Calories,i.Unit) * i.Quantity;
+                    totalProtein += ConvertType(tempIngredient.Protein,i.Unit) * i.Quantity;
+                    totalCarbs += ConvertType(tempIngredient.Carbs,i.Unit) * i.Quantity;
+                    totalFat += ConvertType(tempIngredient.Fat,i.Unit) * i.Quantity;
+                }
+                recipe.Calories = totalCalories;
+                recipe.Protein = totalProtein;
+                recipe.Carbs = totalCarbs;
+                recipe.Fat = totalFat;
+                _context.Update(recipe);
+                await _context.SaveChangesAsync(); 
                 return RedirectToAction(nameof(Index));
             }
@@ -65,11 +96,11 @@
             {
                 foreach (var key in ModelState.Keys)
-{
-    var errors = ModelState[key].Errors;
-    foreach (var error in errors)
-    {
-        Console.WriteLine($"Key: {key} - Error: {error.ErrorMessage}");
-    }
-}
+                {
+                    var errors = ModelState[key].Errors;
+                    foreach (var error in errors)
+                    {
+                        Console.WriteLine($"Key: {key} - Error: {error.ErrorMessage}");
+                    }
+                }
                 Console.WriteLine("Model state is invalid. Please check the input data.");
             }
@@ -158,4 +189,28 @@
             return suggestions;
         }
-    }
+        public async Task<ActionResult<List<Recipe>>> Filter()
+        {
+            string minCalories = Request.Form["MinCalories"];
+            var maxCalories = Request.Form["MaxCalories"];
+            var minProtein = Request.Form["MinProtein"];
+            var maxProtein = Request.Form["MaxProtein"];
+            var minFats = Request.Form["MinFats"];
+            var maxFats = Request.Form["MaxFats"];
+            var minCarbs = Request.Form["MinCarbs"];
+            var maxCarbs = Request.Form["MaxCarbs"];
+            var filteredRecipes = _context.Recipes
+            .Where(r =>
+            (r.Calories >= int.Parse(minCalories)) &&
+            (r.Calories <= int.Parse(maxCalories)) &&
+            (r.Protein >= int.Parse(minProtein)) &&
+            (r.Protein <= int.Parse(maxProtein)) &&
+            (r.Fat >= int.Parse(minFats)) &&
+            (r.Fat <= int.Parse(maxFats)) &&
+            (r.Carbs >= int.Parse(minCarbs)) &&
+            (r.Carbs <= int.Parse(maxCarbs))
+            )
+            .ToList();
+            return filteredRecipes;
+        }
+    } 
 }
Index: NutriMatch/Migrations/20250619201954_AddNutriInfoForRecipe.Designer.cs
===================================================================
--- NutriMatch/Migrations/20250619201954_AddNutriInfoForRecipe.Designer.cs	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
+++ NutriMatch/Migrations/20250619201954_AddNutriInfoForRecipe.Designer.cs	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
@@ -0,0 +1,114 @@
+﻿// <auto-generated />
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using NutriMatch.Data;
+#nullable disable
+namespace NutriMatch.Migrations
+{
+    [DbContext(typeof(AppDbContext))]
+    [Migration("20250619201954_AddNutriInfoForRecipe")]
+    partial class AddNutriInfoForRecipe
+    {
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "9.0.5")
+                .HasAnnotation("Relational:MaxIdentifierLength", 63);
+            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+            modelBuilder.Entity("NutriMatch.Models.Ingredient", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer")
+                        .HasColumnName("id");
+                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
+                    b.Property<float>("Calories")
+                        .HasColumnType("real")
+                        .HasColumnName("energy_kcal");
+                    b.Property<float>("Carbs")
+                        .HasColumnType("real")
+                        .HasColumnName("carbohydrates_g");
+                    b.Property<float>("Fat")
+                        .HasColumnType("real")
+                        .HasColumnName("total_fat_g");
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("text")
+                        .HasColumnName("food_name");
+                    b.Property<float>("Protein")
+                        .HasColumnType("real")
+                        .HasColumnName("protein_g");
+                    b.HasKey("Id");
+                    b.ToTable("food_macronutrients", (string)null);
+                });
+            modelBuilder.Entity("NutriMatch.Models.Recipe", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer");
+                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
+                    b.Property<float>("Calories")
+                        .HasColumnType("real");
+                    b.Property<float>("Carbs")
+                        .HasColumnType("real");
+                    b.Property<float>("Fat")
+                        .HasColumnType("real");
+                    b.Property<string>("Instructions")
+                        .IsRequired()
+                        .HasColumnType("text");
+                    b.Property<float>("Protein")
+                        .HasColumnType("real");
+                    b.Property<float>("Rating")
+                        .HasColumnType("real");
+                    b.Property<string>("Title")
+                        .IsRequired()
+                        .HasColumnType("text");
+                    b.HasKey("Id");
+                    b.ToTable("Recipes");
+                });
+            modelBuilder.Entity("NutriMatch.Models.RecipeIngredient", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("integer");
+                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
+                    b.Property<int>("IngredientId")
+                        .HasColumnType("integer");
+                    b.Property<float>("Quantity")
+                        .HasColumnType("real");
+                    b.Property<int>("RecipeId")
+                        .HasColumnType("integer");
+                    b.Property<string>("Unit")
+                        .IsRequired()
+                        .HasColumnType("text");
+                    b.HasKey("Id");
+                    b.HasIndex("IngredientId");
+                    b.HasIndex("RecipeId");
+                    b.ToTable("RecipeIngredients");
+                });
+            modelBuilder.Entity("NutriMatch.Models.RecipeIngredient", b =>
+                {
+                    b.HasOne("NutriMatch.Models.Ingredient", "Ingredient")
+                        .WithMany()
+                        .HasForeignKey("IngredientId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                    b.HasOne("NutriMatch.Models.Recipe", null)
+                        .WithMany("RecipeIngredients")
+                        .HasForeignKey("RecipeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                    b.Navigation("Ingredient");
+                });
+            modelBuilder.Entity("NutriMatch.Models.Recipe", b =>
+                {
+                    b.Navigation("RecipeIngredients");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}
Index: NutriMatch/Migrations/20250619201954_AddNutriInfoForRecipe.cs
===================================================================
--- NutriMatch/Migrations/20250619201954_AddNutriInfoForRecipe.cs	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
+++ NutriMatch/Migrations/20250619201954_AddNutriInfoForRecipe.cs	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
@@ -0,0 +1,50 @@
+﻿using Microsoft.EntityFrameworkCore.Migrations;
+#nullable disable
+namespace NutriMatch.Migrations
+{
+    public partial class AddNutriInfoForRecipe : Migration
+    {
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<float>(
+                name: "Calories",
+                table: "Recipes",
+                type: "real",
+                nullable: false,
+                defaultValue: 0f);
+            migrationBuilder.AddColumn<float>(
+                name: "Carbs",
+                table: "Recipes",
+                type: "real",
+                nullable: false,
+                defaultValue: 0f);
+            migrationBuilder.AddColumn<float>(
+                name: "Fat",
+                table: "Recipes",
+                type: "real",
+                nullable: false,
+                defaultValue: 0f);
+            migrationBuilder.AddColumn<float>(
+                name: "Protein",
+                table: "Recipes",
+                type: "real",
+                nullable: false,
+                defaultValue: 0f);
+        }
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropColumn(
+                name: "Calories",
+                table: "Recipes");
+            migrationBuilder.DropColumn(
+                name: "Carbs",
+                table: "Recipes");
+            migrationBuilder.DropColumn(
+                name: "Fat",
+                table: "Recipes");
+            migrationBuilder.DropColumn(
+                name: "Protein",
+                table: "Recipes");
+        }
+    }
+}
Index: NutriMatch/Migrations/AppDbContextModelSnapshot.cs
===================================================================
--- NutriMatch/Migrations/AppDbContextModelSnapshot.cs	(revision 55a6d6698e060a0d4f1242a6790162878d7f3a29)
+++ NutriMatch/Migrations/AppDbContextModelSnapshot.cs	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
@@ -50,7 +50,15 @@
                         .HasColumnType("integer");
                     NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
+                    b.Property<float>("Calories")
+                        .HasColumnType("real");
+                    b.Property<float>("Carbs")
+                        .HasColumnType("real");
+                    b.Property<float>("Fat")
+                        .HasColumnType("real");
                     b.Property<string>("Instructions")
                         .IsRequired()
                         .HasColumnType("text");
+                    b.Property<float>("Protein")
+                        .HasColumnType("real");
                     b.Property<float>("Rating")
                         .HasColumnType("real");
@@ -61,5 +69,5 @@
                     b.ToTable("Recipes");
                 });
-            modelBuilder.Entity("NutriMatch.Models.RecipeIngredients", b =>
+            modelBuilder.Entity("NutriMatch.Models.RecipeIngredient", b =>
                 {
                     b.Property<int>("Id")
@@ -81,5 +89,5 @@
                     b.ToTable("RecipeIngredients");
                 });
-            modelBuilder.Entity("NutriMatch.Models.RecipeIngredients", b =>
+            modelBuilder.Entity("NutriMatch.Models.RecipeIngredient", b =>
                 {
                     b.HasOne("NutriMatch.Models.Ingredient", "Ingredient")
Index: NutriMatch/Models/Recipe.cs
===================================================================
--- NutriMatch/Models/Recipe.cs	(revision 55a6d6698e060a0d4f1242a6790162878d7f3a29)
+++ NutriMatch/Models/Recipe.cs	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
@@ -18,4 +18,12 @@
         [ValidateNever]
         public virtual List<RecipeIngredient> RecipeIngredients { get; set; }   
+        [ValidateNever]
+        public float Calories { get; set; }
+        [ValidateNever]
+        public float Protein { get; set; }
+        [ValidateNever]
+        public float Carbs { get; set; }
+        [ValidateNever]
+        public float Fat { get; set; }
         
     }
Index: NutriMatch/Views/Home/Index.cshtml
===================================================================
--- NutriMatch/Views/Home/Index.cshtml	(revision 55a6d6698e060a0d4f1242a6790162878d7f3a29)
+++ NutriMatch/Views/Home/Index.cshtml	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
@@ -1,7 +1,50 @@
-﻿@{
+﻿
+@{
     ViewData["Title"] = "Home Page";
 }
+<html>
 <div class="text-center">
-    <h1 class="display-4">Welcome</h1>
-    <p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
+        <form id="filterForm">
+         <div class="row">
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Calories (Min)</label>
+                <input name="MinCalories" class="form-control" type="number" />
+            </div>
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Calories (Max)</label>
+                <input name="MaxCalories" class="form-control" type="number" />
+            </div>
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Protein (Min)</label>
+                <input name="MinProtein" class="form-control" type="number" />
+            </div>
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Protein (Max)</label>
+                <input name="MaxProtein" class="form-control" type="number" />
+            </div>
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Fats (Min)</label>
+                <input name="MinFats" class="form-control" type="number" />
+            </div>
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Fats (Max)</label>
+                <input name="MaxFats" class="form-control" type="number" />
+            </div>
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Carbs (Min)</label>
+                <input name="MinCarbs" class="form-control" type="number" />
+            </div>
+            <div class="col-md-6 mb-3">
+                <label class="form-label">Carbs (Max)</label>
+                <input name="MaxCarbs" class="form-control" type="number" />
+            </div>
+            <div class="col-12 text-end">
+                <button type="button" class="btn btn-primary" id="submitFilter">Search Recipes</button>
+            </div>
+        </form>
+    </div>
 </div>
+<div id="resultsContainer" class="mt-4"></div>
+</div>
+<script src="~/js/filter.js"></script>
+</html>
Index: NutriMatch/wwwroot/js/filter.js
===================================================================
--- NutriMatch/wwwroot/js/filter.js	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
+++ NutriMatch/wwwroot/js/filter.js	(revision 083bca809028a181a47ef56f4cd6e642a84cf9e0)
@@ -0,0 +1,21 @@
+
+document.getElementById("submitFilter").addEventListener("click", async function () {
+const form = document.getElementById("filterForm");
+const data = new FormData(form);
+
+const response = await fetch("/Recipes/Filter", {
+    method: "POST",
+    body: data,
+    headers: {
+        "X-Requested-With": "XMLHttpRequest"
+    }
+});
+
+if (response.ok) {
+    const html = await response.text();
+    document.getElementById("resultsContainer").innerHTML = html;
+    console.log(html);
+} else {
+    alert("Something went wrong while fetching recipes.");
+}
+});
