コード例 #1
0
 public ActionResult GetTrackingDetails(int OrgId)
 {
     using (var OrgContext = new TsaContext())
     {
         var OrgDetails = OrgContext.CustomTrackingCode.Where(q => q.OrgId == OrgId).SingleOrDefault();
         return(Ok(OrgDetails));
     }
 }
コード例 #2
0
 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));
 }