/// <summary> /// Gets the tag. /// </summary> /// <param name="tag">The tag.</param> /// <returns></returns> private Model.Tag.Tag getTag(tags_users_subscription tag) { Model.Tag.Tag newTag = new XareuServices.Model.Tag.Tag(); newTag.Id = tag.tag_id; newTag.Name = tag.tag.tag_name; return(newTag); }
/// <summary> /// Gets the tag. /// </summary> /// <param name="tag">The tag.</param> /// <returns></returns> private Model.Tag.Tag getTag(tag tag) { Model.Tag.Tag newTag = new XareuServices.Model.Tag.Tag(); newTag.Id = tag.tag_id; newTag.Name = tag.tag_name; return(newTag); }
/// <summary> /// Edits the tag. /// </summary> /// <param name="tag">The tag.</param> /// <returns>True if it was OK, false otherwise</returns> public bool EditTag(XareuServices.Model.Tag.Tag tag) { try { Linq.tag actualTagData = (from tags in data.tags where tags.tag_id == tag.Id select tags).First <tag>(); actualTagData.tag_name = tag.Name; data.SubmitChanges(); return(true); } catch { return(false); } }
/// <summary> /// Adds the tag. /// </summary> /// <param name="userID">The user ID.</param> /// <param name="token">The token.</param> /// <param name="newToken">The new token.</param> /// <param name="tag">The tag.</param> /// <param name="tagID">The tag ID.</param> /// <returns>True if it was OK, false otherwise</returns> public bool AddTag(long userID, Guid token, out Guid newToken, XareuServices.Model.Tag.Tag tag, out long tagID) { if (loginService.UseToken(userID, token, out newToken)) { try { return(tagDAO.AddTag(tag, out tagID)); } catch { throw new Exception("Adding tag error"); } } throw new Exception("Login error"); }
/// <summary> /// Adds the tag. /// </summary> /// <param name="tag">The tag.</param> /// <param name="tagID">The tag ID.</param> /// <returns>True if it was OK, false otherwise</returns> public bool AddTag(XareuServices.Model.Tag.Tag tag, out long tagID) { tagID = 0; try { Linq.tag tagToAdd = new tag(); tagToAdd.tag_name = tag.Name; data.tags.InsertOnSubmit(tagToAdd); data.SubmitChanges(); tagID = this.getLastInsertedTagID(); return(true); } catch { return(false); } }
/// <summary> /// Edits the tag. /// </summary> /// <param name="userID">The user ID.</param> /// <param name="token">The token.</param> /// <param name="newToken">The new token.</param> /// <param name="tag">The tag.</param> /// <returns>True if it was OK, false otherwise</returns> public bool EditTag(long userID, Guid token, out Guid newToken, XareuServices.Model.Tag.Tag tag) { if (loginService.UseToken(userID, token, out newToken)) { try { if (userDAO.IsAdmin(userID)) { return(tagDAO.EditTag(tag)); } throw new Exception("User can't edit a tag"); } catch { throw new Exception("Editting tag error"); } } throw new Exception("Login error"); }
/// <summary> /// Edits the tag. /// </summary> /// <param name="userID">The user ID.</param> /// <param name="token">The token.</param> /// <param name="newToken">The new token.</param> /// <param name="tag">The tag.</param> /// <returns>True if it was OK, false otherwise</returns> public bool EditTag(long userID, Guid token, out Guid newToken, XareuServices.Model.Tag.Tag tag) { return(tagService.EditTag(userID, token, out newToken, tag)); }
/// <summary> /// Adds the tag. /// </summary> /// <param name="userID">The user ID.</param> /// <param name="token">The token.</param> /// <param name="newToken">The new token.</param> /// <param name="tag">The tag.</param> /// <param name="tagID">The tag ID.</param> /// <returns>True if it was OK, false otherwise</returns> public bool AddTag(long userID, Guid token, out Guid newToken, XareuServices.Model.Tag.Tag tag, out long tagID) { return(tagService.AddTag(userID, token, out newToken, tag, out tagID)); }