markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 303 forks source link

cannot update. please help #382

Closed john-qin closed 8 years ago

john-qin commented 8 years ago

I am using sql server 2008. I got this error message "Cannot implicitly convert type 'int' to 'XDocImportSvc.Models.CorvelRequest" when i tried to update a record, couldn't figure out what the problem is. Please help.

    public CorvelRequest InsertCorvelRequest(CorvelRequest item)
    {
        if (item.Id > 0)
        {
            return _db.CorvelRequest.Update(item);
        }
        else
        {
            return _db.CorvelRequest.Insert(item);
        }
    }

Insert works. i can insert it to the DB , but update failed. I also tried UpdateById, got the same error. item is the same for both insert and update except for update Id is not 0.

john-qin commented 8 years ago

fixed.