// // SkillController.cs // // Author: // Paul Schneider // // Copyright (c) 2015 GNU GPL // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . using System; using Yavsc.Model.Skill; using System.Web.Http; using Yavsc.Model; namespace Yavsc.ApiControllers { /// /// Skill controller. /// public class SkillController : YavscController { /// /// Create or update the specified Skill. /// /// the Skill objet. [ValidateAjaxAttribute,Authorize(Roles="Profiler")] public long DeclareSkill (SkillEntity s) { if (ModelState.IsValid) { SkillManager.DeclareSkill (s); } return s.Id; } /// /// Declares the user's skill, /// This call should be in charge of /// the user himself, it's an user /// declaration, and as a result, /// this only is a declarative caracterisation of /// the user's skills. /// /// The skill. /// Dec. [Authorize()] public long DeclareUserSkill (UserSkillDeclaration dec) { return SkillManager.DeclareUserSkill(dec); } /// /// Rate the specified user's skill. /// A way for an effective client to rate /// the service or good he should have got. /// This is the king's value /// /// The user skill rating. [Authorize()] public long RateUserSkill (UserSkillRating rate) { return SkillManager.RateUserSkill(User.Identity.Name, rate); } /// /// Rates the skill. /// /// Skill rating. [Authorize()] public void RateSkill (SkillRating rate) { SkillManager.RateSkill(User.Identity.Name,rate); } /// /// Finds the skill identifier. /// /// The skill identifier. /// Pattern. public SkillEntity [] FindSkill (string pattern){ return SkillManager.FindSkill(pattern); } /// /// Finds the performer. /// /// The performer. /// Skill identifiers. public string [] FindPerformer (long []skillIds){ return SkillManager.FindPerformer(skillIds); } /// /// Deletes the skill. /// /// Skill identifier. [Authorize(Roles="Moderator")] public void DeleteSkill (long skillId) { SkillManager.DeleteSkill (skillId); } } }