Ejemplo n.º 1
0
        /// <summary>
        /// Gets one note and its categories
        /// </summary>
        public NoteWithCategories Read(int id)
        {
            // these are two database calls (this could be a little bit slower)
            NoteWithCategories noteWithCategories = new NoteWithCategories(
                this.WebNoteRepository.GetNote(id),
                this.WebNoteCategoryRepository.GetCategories(id));

            ////Thread.Sleep(3000); // make it very slow
            return(noteWithCategories);
        }
        public static string ColoredCheckBoxes(this HtmlHelper htmlHelper, NoteWithCategories model, object allAvailableCategories, string checkBoxName)
        {
            IEnumerable<Category> allCategories = allAvailableCategories as IEnumerable<Category>;
            if (allCategories != null)
            {
                StringBuilder tmp = new StringBuilder();
                foreach (Category category in allCategories)
                {
                    tmp.AppendFormat(
                        CultureInfo.InvariantCulture,
                        Format,
                        category.CategoryId, // 1
                        (model != null && model.Categories.Contains(category) ? " checked=\"checked\"" : String.Empty), // 2
                        category.Color, // 3
                        category.Name, // 4
                        checkBoxName);  // 5
                }

                return "<ul>" + tmp + "</ul>";
            }

            return "Wrong Data";
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets one note and its categories
        /// </summary>
        public NoteWithCategories Read(int id)
        {
            // these are two database calls (this could be a little bit slower)
            NoteWithCategories noteWithCategories = new NoteWithCategories(
                this.WebNoteRepository.GetNote(id),
                this.WebNoteCategoryRepository.GetCategories(id));

            ////Thread.Sleep(3000); // make it very slow
            return noteWithCategories;
        }