예제 #1
0
        public bool EditTag(AnnotationTagFormModel model, int id)
        {
            var tag = DbContext.AnnotationTags.First(t => t.Id == id);

            if (tag == null)
            {
                return(false);
            }

            if (model.Description != null)
            {
                tag.Description = model.Description;
            }
            if (model.Layer != null)
            {
                tag.Layer = model.Layer;
            }
            if (model.Name != null)
            {
                tag.Name = model.Name;
            }
            if (model.ShortName != null)
            {
                tag.ShortName = model.ShortName;
            }
            if (model.Style != null)
            {
                tag.Style = model.Style;
            }
            DbContext.SaveChanges();
            return(true);
        }
예제 #2
0
        public EntityResult AddTag(AnnotationTagFormModel tagModel)
        {
            var tag = new AnnotationTag(tagModel);

            DbContext.AnnotationTags.Add(tag);
            DbContext.SaveChanges();

            return(EntityResult.Successfull(tag.Id));
        }