Save Data to Database using Modal Popup in ASP.Net MVC

PHOTO EMBED

Fri Feb 04 2022 05:55:29 GMT+0000 (Coordinated Universal Time)

Saved by @rajeshnrh

public class HomeController : Controller
{
    // GET: Home
    public ActionResult Index()
    {
        return View();
    }
 
    [HttpPost]
    public ActionResult Index(Customer customer)
    {
        using (CustomerEntities entities = new CustomerEntities())
        {
            entities.Customers.Add(customer);
            entities.SaveChanges();
            int id = customer.CustomerId;
        }
        return View(customer);
    }
}
content_copyCOPY

https://www.aspsnippets.com/Articles/Save-Data-to-Database-using-Modal-Popup-in-ASPNet-MVC.aspx