public Area CreateArea(Area area) { using (var db = new CardsDb()) { var result = db.Areas.Add(area); db.SaveChanges(); return result; } }
public Area Put(int id, Area area) { return Area.Update(id, area.Name); }
public Area Post(Area area) { return Area.Create(area.Name); }
public static Area Create(string name) { var db = DbFactory.Create(); var area = new Area() { Name = name, }; return db.CreateArea(area); }
public Area UpdateArea(Area area) { using (var db = new CardsDb()) { db.Entry(area).State = EntityState.Modified; db.SaveChanges(); return area; } }