Skip to content

Instantly share code, notes, and snippets.

@shankardevy
Created July 8, 2017 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shankardevy/4d1cc70365b38566135daa0e6fc632fe to your computer and use it in GitHub Desktop.
Save shankardevy/4d1cc70365b38566135daa0e6fc632fe to your computer and use it in GitHub Desktop.
defmodule Mango.Sales do
alias Mango.Repo
alias Mango.Sales.Order
def get_cart(id) do
Order
|> Repo.get_by(id: id, status: "In Cart")
end
def create_cart do
%Order{status: "In Cart"} |> Repo.insert!()
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment