public Card CreateCard(Card card) { using (var db = new CardsDb()) { var result = db.Cards.Add(card); db.SaveChanges(); return result; } }
public static Card Create(string name, int areaId) { var db = DbFactory.Create(); var card = new Card() { Name = name, AreaID = areaId, CreatedDateUtc = DateProvider.UtcNow(), ModifiedDateUtc = DateProvider.UtcNow() }; card = db.CreateCard(card); Activity.Create(card.ID, areaId, CardChangeType.Transfer, null); return card; }
public Card Put(int id, Card card) { return Card.Update(id, card.Name, card.AreaID); }
public Card Post(Card card) { return Card.Create(card.Name, card.AreaID); }
public Card UpdateCard(Card card) { using (var db = new CardsDb()) { db.Entry(card).State = EntityState.Modified; db.SaveChanges(); return card; } }