// insert data public void InsertData(TaskModelService datarecv3) { //ctx.AspNetTask.Add() ctx.AspNetTask.Add(new AspNetTask() { QuoteType = datarecv3.QuoteTypeS, Contact = datarecv3.ContactS, Task = datarecv3.TaskS, TaskType = datarecv3.TaskTypeS }); ctx.SaveChanges(); }
// update the specific data by id public void UpdateData(int id, TaskModelService value) { var datarecv4 = ctx.AspNetTask.Where(s => s.QuoteID == id).FirstOrDefault <AspNetTask>(); if (datarecv4 != null) { datarecv4.QuoteType = value.QuoteTypeS; datarecv4.Contact = value.ContactS; datarecv4.Task = value.TaskS; datarecv4.TaskType = value.TaskTypeS; ctx.SaveChanges(); } else { ; } }