Exemplo n.º 1
0
        /// <summary>
        /// Add a new tag to database.
        /// </summary>
        /// <param name="model">The new tag.</param>
        /// <returns>The new tag.</returns>
        public static Tag Add(Tag model)
        {
            Database db = new Database();

            var @in = Mapper.Map<TagDTO>(model);

            var result = db.TagEntity.Add(@in);

            var @out = Mapper.Map<Tag>(result);

            return @out;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add o update a tag.
        /// </summary>
        /// <param name="model">The tag.</param>
        /// <returns>The tag.</returns>
        public static Tag Set(Tag model)
        {
            var tag = Get(model.Id);
            model.Id = tag.Id;

            if (tag.Id == 0)
                return Tag.Add(model);
            else
                return Tag.Update(model);
        }