public bool MtSetPostCategories(string postid, string username, string password, MtCategory[] categories) { this.ValidateUser(username, password); // do nothing here, we handle the category assignemnt in the AddPost and UpdatePost functions return true; }
public MtCategory[] MtGetPostCategories(string postid, string username, string password) { this.ValidateUser(username, password); PostDto item = this.postService.GetPostByKey(postid.ToInt32()); IList<CategoryDto> categories = this.categoryService.GetCategories(); MtCategory[] cats = new MtCategory[item.Categories.Length]; for (int i = 0; i < item.Categories.Length; i++) { CategoryDto cat = categories.Single(c => c.Name.ToLowerInvariant() == item.Categories[i]); cats[i] = new MtCategory { categoryId = cat.Id.ToString(CultureInfo.InvariantCulture), categoryName = cat.Name, // todo: fill up the 'is primary field", maybe this must be true for the first category only isPrimary = (i == 0) }; } return cats; }