public void bindTraingtype() { DataSet ds = null; Trainingmaster master = new Trainingmaster(); master.Action = "Select"; ds = master.FTrainingmaster(master); ViewBag.data = ds.Tables[0]; List<SelectListItem> items = new List<SelectListItem>(); items.Add(new SelectListItem { Text = "Select", Value = "0" }); foreach (System.Data.DataRow dr in ViewBag.data.Rows) { items.Add(new SelectListItem { Text = @dr["Name"].ToString(), Value = @dr["Id"].ToString() }); } ViewData["Type"] = items; }
public ActionResult Index(Trainingmaster model, string submit) { if (submit == "Submit" || submit == null) { master.Action = "Insert"; master.Name = model.Name; DataSet ds = master.FTrainingmaster(master); TempData["message"] = ds.Tables[0].Rows[0][0].ToString(); } else { master.Action = "Update"; master.T_Id = model.T_Id; master.Name = model.Name; DataSet ds = master.FTrainingmaster(master); TempData["message"] = ds.Tables[0].Rows[0][0].ToString(); } return RedirectToAction("Index", "Trainingmaster"); }
public void trainigdata() { DataSet ds = null; Trainingmaster Trainig = new Trainingmaster(); Trainig.Action = "Select"; ds = Trainig.FTrainingmaster(Trainig); ViewData["AllcouData"] = ds.Tables[0]; }