Guys I've a EntityModel called mapsModel, which has an entity Type called 'BodyChartNew'
For Inserting records I'm using a Handler called InsertMap, In this handler I'm using the code like as follows:
using System;
using System.Web;
public class InsertMap : IHttpHandler
{
private mapsModel.mapsEntities _dataContext = new mapsModel.mapsEntities();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
// Extract form fields
var title = context.Request["title"];
var note = context.Request["remarks"];
var referenceID = context.Request["patient_id"];
var diagnosisID = context.Request["diagnosis_id"];
// Create Chart to insert
var mapsToInsert = new mapsModel.BodyChart { MapCode = title, Remarks = note, PatientID = Convert.ToInt32(referenceID), DiagnosisID = Convert.ToInt32(diagnosisID) };
// Save new movie to DB
try
{
_dataContext.AddToBodyChart(mapsToInsert);
_dataContext.SaveChanges();
// Return success
context.Response.Write("success");
}
catch
{
context.Response.Write("fail");
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
I'm calling this Handler from my JQuery Code, This is working fine for me with INSERT, what I need is UPDATE code. What is the UPDATE statement to update the records based on referenceID and diagnosisID ?
Please help me!