ErrorMessage :
Attaching an entity of type \'FaridCRMData.Models.Customer\' failed because another entity of the same type already has the same prim
You need to detach the local version first and then do the update process
var localEntity = dbContext.Set()
.Local
.FirstOrDefault(f => f.Id == theModel.Id);
if (localEntity != null)
{
dbContext.Entry(localEntity).State = EntityState.Detached;
}
dbContext.Entry(appModel).State = EntityState.Modified;