Here your link which is populating DropDown from same table, but now i want to get data in DropDownList from another table
Create table tbl_user (U_ID int, UserName varchar(50))
Create table customer (CustomerID int,name varchar(50), U_ID int)
means that i have to perform crud operation on Customer table.
I tried but it is not updating value
please help me out
public ActionResult UpdateCustomer2(Customer customer)
{
Customer updatedCustomer = (from c in DB.Customers
where c.CustomerId == customer.CustomerId
select c).FirstOrDefault();
updatedCustomer.Name = customer.Name;
updatedCustomer.UserID = customer.UserID;
DB.SaveChanges();
return new EmptyResult();
}
[HttpPost]
public ActionResult GetUserName()
{
return Json(DB.tblUsers.Select(x => x.UserName).Distinct().ToList());
}