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); }
public EntityResult AddTag(AnnotationTagFormModel tagModel) { var tag = new AnnotationTag(tagModel); DbContext.AnnotationTags.Add(tag); DbContext.SaveChanges(); return(EntityResult.Successfull(tag.Id)); }