public ActionResult GetTrackingDetails(int OrgId) { using (var OrgContext = new TsaContext()) { var OrgDetails = OrgContext.CustomTrackingCode.Where(q => q.OrgId == OrgId).SingleOrDefault(); return(Ok(OrgDetails)); } }
public ActionResult AddTrackingDetails([FromBody] CustomTrackingCode OrgDetails) { using (var OrgContext = new TsaContext()) { var userDetails = OrgContext.CustomTrackingCode.AsNoTracking().Where(q => q.OrgId == OrgDetails.OrgId).SingleOrDefault(); if (userDetails != null) { OrgContext.CustomTrackingCode.Update(OrgDetails); OrgContext.SaveChanges(); } else { OrgContext.CustomTrackingCode.Add(OrgDetails); OrgContext.SaveChanges(); } } return(Ok(OrgDetails)); }