使用mvc3进行CRUD但如何进行搜索功能? [英] used mvc3 for CRUD but how to do a search feature?
本文介绍了使用mvc3进行CRUD但如何进行搜索功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi...
Ive used http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/crud-operation-in-Asp-Net-mvc-framework/ to create a database driven website for a rental company using the CRUD outlook...but now im looking to add a search feature and cant find any online....any help guys?
iv tried something like
public ActionResult Search(int id)
{
return View();
}
[HttpPost]
public ActionResult Search(Rental rentals)
{
try
{
_entities.//find record(rentals);
_entities.SaveChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
Thanks
推荐答案
var dbdata =(来自v in contex.VotnetMasters
其中v.VotnetID == csv.VotnetID
选择新的{v.MemberID,v.OnlineUsername})。FirstOrDefault();
var dbdata = (from v in contex.VotnetMasters
where v.VotnetID == csv.VotnetID
select new { v.MemberID,v.OnlineUsername }).FirstOrDefault();
这篇关于使用mvc3进行CRUD但如何进行搜索功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文