entity framework - Web API 2 modify db in GET method -


i want modify fields after query, return value changed after modified fields.

i want keep iqueryable value after modify it.

how can store iqueryable value?

public iqueryable<book> getbook(int id)     {         iqueryable<book> books = null;         iqueryable<book> book_return = null;         books = db.book.where(u => u.id == id && u.is_read != true);          book_return = books;          foreach (var item in books)         {              item.read_time = datetime.now;             item.is_read = true;             db.entry(item).state = entitystate.modified;         }          try         {             db.savechanges();         }         catch (dbupdateconcurrencyexception)         {             throw;         }          return book_return;     } 

you use:

ienumerable<book> book_return = null     book_return = books.tolist(); 

and return type of method must ienumerable<book>,


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -