Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tahir AnsariRank #366 · 6.8K reputationPosted Oct 27, 2023, 1:30 AM EDT
public class Product { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } // Add other properties as needed }Create a DbContext
public class ApplicationDbContext : DbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } public DbSet Products { get; set; } }Controller: Create a controller with CRUD actions, including a search action.
public IActionResult Search(string searchTerm) { var results = _context.Products .Where(p => p.Name.Contains(searchTerm)) .ToList(); return View("Index", results); }Jignesh KumarRank #91 · 22.9K reputationPosted Oct 27, 2023, 6:18 AM EDT
Helo Jangama,
Please refer this link which will hlep you out,
https://www.c-sharpcorner.com/article/implement-crud-operations-with-sorting-searching-and-paging-using-ef-core-in-as/
Sam HobbsRank #107 · 20.5K reputationPosted Oct 27, 2023, 1:48 PM EDT
CRUD is not a single operation, it is a combination of create, replace, update and delete. They all use something else, typically SQL, to do what they do. SQL can also be used to do searches, the most common use of SQL.
In .Net LInQ can be used to search.
How to implement search for your applicaiton depends on the framework, if any, you are using and the requirements of the search. Complex searches require more complicated solutions than simple searches.
If none of the existing responses help then if you can describe your requirements better then you are more likely to get more relevant answers.