Home > Mobile >  How I can update using Microsoft.EntityFrameworkCore without change the Id?
How I can update using Microsoft.EntityFrameworkCore without change the Id?

Time:05-19

I did updating my data using NuGet Microsoft.EntityFrameworkCore and success, but the Id data is changed. How i could update data without change the Id data?

this picture before i'm update the data :

enter image description here

and this after i'm update the data: enter image description here

this my controller code :

        public IActionResult Edit(int? Id)
        {
            var DataCustomer = _conn.tabel_customer.Where(c => c.CustomerId == Id).FirstOrDefault();
            return View(DataCustomer);
        }
        [HttpPost]
        public IActionResult Edit(Customer customer)
        {
            _conn.Update(customer);
            _conn.SaveChanges();
            TempData["Message"] = "The Record "   customer.Name   " Is  Changed Successfully           
  • Related