public Bank AddBank(Bank entity) { var b = adapter.Insert <Bank>(entity); adapter.SaveChanges(); return(b); }
public ActionResult <Result> Post(string key, string priority, string desc) { ToDoItem item = new ToDoItem() { ItemId = (dataAdapter.Select(x => x.Key == key).Max(x => (int?)x.ItemId) ?? 0) + 1, Key = key, Description = desc, Priority = priority, CreateDate = DateTime.Now, CompleteDate = DateTime.MinValue }; dataAdapter.Insert(item); return(Result.GenerateResult(201, item.ItemId)); }
public ActionResult <Result> CreatePortfolio(string key, string name = "MyPortfolio") { Portfolio portfolio = new Portfolio { Key = key, PortfolioId = (dataAdapter.Select(x => x.Key == key).Max(x => (int?)x.PortfolioId) ?? 0) + 1, PortfolioName = name, Details = new Dictionary <Category, List <Holding> >(), TotalValue = 0, CreateDate = DateTime.Now, LastUpdateDate = DateTime.Now }; dataAdapter.Insert(portfolio); return(Result.GenerateResult(201, portfolio.PortfolioId)); }
public T Add <T>(T entity) where T : class => adapter.Insert(entity);