public ContentResult UpdateExternalKey(Guid kcsaraId, int externalId, string id) { if (!Permissions.IsInRole("cdb.admins")) { throw new InvalidOperationException(); } var entry = this.db.xref_county_id.Where(f => f.personId == kcsaraId && f.ExternalSource == id).SingleOrDefault(); if (entry == null) { entry = new Kcsar.Database.Model.xref_county_id { personId = kcsaraId, ExternalSource = id }; this.db.xref_county_id.Add(entry); } entry.accessMemberID = externalId; this.db.SaveChanges(); return(new ContentResult { Content = "OK", ContentType = "text/plain" }); }
public ContentResult UpdateExternalKey(Guid kcsaraId, int externalId, string id) { if (!Permissions.IsInRole("cdb.admins")) throw new InvalidOperationException(); var entry = this.db.xref_county_id.Where(f => f.personId == kcsaraId && f.ExternalSource == id).SingleOrDefault(); if (entry == null) { entry = new Kcsar.Database.Model.xref_county_id { personId = kcsaraId, ExternalSource = id }; this.db.xref_county_id.Add(entry); } entry.accessMemberID = externalId; this.db.SaveChanges(); return new ContentResult { Content = "OK", ContentType = "text/plain" }; }