Skip to content

Instantly share code, notes, and snippets.

@lefthandedgoat
Created September 10, 2012 21:50
Show Gist options
  • Save lefthandedgoat/3694175 to your computer and use it in GitHub Desktop.
Save lefthandedgoat/3694175 to your computer and use it in GitHub Desktop.
let setTerminationDate agentNumber toTerminated =
using(new AgencyManagement()) (fun db ->
let agent = query <@ seq { for a in db.Agents do
if a.AgentNumber = agentNumber then yield a } @> |> Seq.head
if toTerminated = true then
agent.TerminationDate <- new Nullable<DateTime>(DateTime.Now)
else
agent.TerminationDate <- new Nullable<DateTime>()
db.SaveChanges() |> ignore
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment