예제 #1
0
        public Label DeleteLabel(Label label)
        {
            using (var db = new CardsDb())
            {
                db.Entry(new Label() { ID = label.ID }).State = EntityState.Deleted;
                db.SaveChanges();

                return label;
            }
        }
예제 #2
0
        public Label CreateLabel(Label label)
        {
            using (var db = new CardsDb())
            {
                label = db.Labels.Add(label);
                db.SaveChanges();

                return label;
            }
        }
예제 #3
0
파일: Label.cs 프로젝트: jannavarro/cards
        public static Label Create(string name, string color)
        {
            var db = DbFactory.Create();

            //contruct label object
            var label = new Label()
            {
                Name = name,
                Color = color
            };

            label = db.CreateLabel(label);
            LabelCache.Reset();

            return label;
        }
예제 #4
0
 public Label Post(Label label)
 {
     return Label.Create(label.Name, label.Color);
 }
예제 #5
0
 public Label Delete(Label label)
 {
     return Label.Delete(label.Name);
 }