public int SetCategories(string postid, string username, string password, Category[] cats) { var post = Hana.Model.Post.SingleOrDefault(x => x.PostID == int.Parse(postid)); //delete em Hana.Model.Categories_Post.Delete(x=>x.PostID==int.Parse(postid)); //save the cats foreach(var cat in cats) { AssignCategory(int.Parse(postid), cat.categoryName); } return 0; }
public Category[] GetCategories(string blogid, string username, string password) { if (ValidateUser(username, password)) { var list = Hana.Model.Category.All(); var cats = new List<Category>(); string siteUrl = Hana.Model.Blog.BlogURL; foreach (var item in list) { Category c = new Category(); c.categoryId = item.CategoryID.ToString(); c.description = item.Description; c.htmlUrl = siteUrl + "/category/" + item.Slug; c.rssUrl = siteUrl + "/category/" + item.Slug + ".rss"; c.title = item.Description; cats.Add(c); } return cats.ToArray(); } throw new XmlRpcFaultException(0, "User is not valid!"); }