Sivakumar

Sivakumar

  • NA
  • 551
  • 217.7k

Updated changes not saving to database table

Oct 5 2015 12:42 AM
Hi,
 
 This is my code :
 
public List<NotificationData> ReadNotification(int memberId, int NotificationId)
{
using (KiwiDbContext context=new KiwiDbContext(_ConnectionString))
{
NotificationData nd = new NotificationData();
nd.IsRead = true;

var query = (from n in context.Notifications where n.MemberID == memberId && n.NotificationID == NotificationId && n.IsRead == false select new NotificationData { NotificationID = n.NotificationID, Message = n.Message, CreatedTime = n.NotificationTime, IsRead = nd.IsRead });
return query.ToList();


context.SaveChanges();
} 
 
This execution is done but the updated result is not saving to database table
 
Please give me a correct code for that.
 
Thank you.

Answers (10)