using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.Http; using Npgsql.Web.Blog; using Yavsc.Model.Blogs; using System.IO; namespace Yavsc.ApiControllers { /// /// Blogs API controller. /// public class BlogsController : ApiController { private const string adminRoleName = "Admin"; /// /// Initialize the specified controllerContext. /// /// Controller context. protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext) { base.Initialize (controllerContext); if (!Roles.RoleExists (adminRoleName)) { Roles.CreateRole (adminRoleName); } } /// /// Tag the specified postid and tag. /// /// Postid. /// Tag. public long Tag (long postid,string tag) { BlogManager.GetForEditing (postid); return BlogManager.Tag (postid, tag); } /// /// Removes the post. /// /// User. /// Title. [Authorize] public void RemoveTitle(string user, string title) { BlogManager.CheckAuthCanEdit (user,title); BlogManager.RemoveTitle (user, title); } /// /// Removes the tag. /// /// Tagid. public void RemoveTag(long tagid) { throw new NotImplementedException (); } } }