Posts

Showing posts from August, 2020

Display Multi-pal List in Single View in c# MVC

 Display Student Details and Student Marks in Single view StudentMarksViewModel  public class StudentMarksViewModel     {         public int Id { get; set; }         public Nullable<int> Maths { get; set; }         public Nullable<int> Phy { get; set; }         public Nullable<int> chemestriy { get; set; }     } StudentDetailViewModel public class StudentViewModel     {         public int StudentId { get; set; }         public string Name { get; set; }         public string Streem { get; set; }         public string ContactNumber { get; set; }         public string Address { get; set; }     } TwoListViewModel  public class TwoListViewModel     {         public IEnumerable<Final_Form_Student> Final_Stude...

Using Store Procedure Select Data From Two Table And Get List In MVC

 Controller  public ActionResult StudentDetail()         {             var Data = _context.Database.SqlQuery<Your Class >("YourStoreProcedre Name").ToList();             return View(Data);         } View @model IEnumerable<interview2.Models.StudentViewModel> @{     ViewBag.Title = "StudentDetail"; } <h2>StudentDetail</h2> <p>     @Html.ActionLink("Create New", "Create") </p> <table class="table">     <tr>         <th>             @Html.DisplayNameFor(model => model.Maths)         </th>         <th>             @Html.DisplayNameFor(model => model.Phy)         </th>         <th>         ...

Insert Data Of RaddioButton in DataBase and Get Data From DataBase in RadioButton

 Insert Data in DataBase  Controller  [HttpPost]         public ActionResult Create(Final_Form model, bool Csharp, bool Fsharp, bool JAVA, bool php)         {             Final_Form final_Form = new Final_Form();             final_Form.Intrested_C_ = (Csharp==true)? true:false;             final_Form.Intrested_F_ = (Fsharp==true)? true:false;             final_Form.Intrested_JAVA = (JAVA==true)?true:false;             final_Form.Intrested_PHP = (php==true)?true:false;             final_Form.Gender = model.Gender;//radioButton              _context.Final_Form.Add(final_Form);             _context.SaveChanges();             return RedirectToAction("index");   ...

CheckBox in Asp.Net MVC (Insert Data of CheckBox in Database and GetData Of checkBox From DataBase)

Insert Data of CheckBox in Database  Controller        [HttpGet]           public ActionResult Create()         {             return View();         }        [HttpPost]         public ActionResult Create(Final_Form model, bool Csharp, bool Fsharp, bool JAVA, bool php)         {             Final_Form final_Form = new Final_Form();             final_Form.Intrested_C_ = (Csharp==true)? true:false;             final_Form.Intrested_F_ = (Fsharp==true)? true:false;             final_Form.Intrested_JAVA = (JAVA==true)?true:false;             final_Form.Intrested_PHP = (php==true)?true:false;             _context.Final_Form.Add(final_F...

Contains function in LINQ C#

Image
Contains In LINQ .  Example :             string[] names = { "Alex", "Apu", "sanju", "Bhoomi", "Riya", "Anu" };             IEnumerable<string> Rsult = from nm in names                                         where nm.Contains("A")                                         select nm;             foreach (string p in Rsult)             {                 Response.Write(p + "</br>");             }

LINQ StartWith() EndWith() use in Query C# (

Image