How to Update only single field using EF

后端 未结 3 1441
傲寒
傲寒 2020-12-18 15:55

This is the current basic code :

    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Edit(Registration registration)
    {
        if (Mode         


        
3条回答
  •  北海茫月
    2020-12-18 16:13

    Registration registor =db.Registration.First(f=>RegistrationId==RegistrationId);
    registor.Date = registration.Date;
    db.SaveChanges();
    

    use this for single record updation and i assuming that RegistrationId in your Registration table.

提交回复
热议问题