public async void AddExpenseParse(string name, string imageUrl, string description, double price,
            Category category)
        {
            var newExpense = ParseObject.Create<ExpenseParse>();
            newExpense = new ExpenseParse
            {
                Name = name,
                ImageUrl = imageUrl,
                Description = description,
                Price = price
            };
            var selected = await ParseObject.GetQuery("CategoryParse")
                    .WhereContains("Name", category.ToString()).FirstOrDefaultAsync() as CategoryParse;

            if (selected == null)
            {
                selected = ParseObject.Create<CategoryParse>();
                selected.Expenses = new List<ExpenseParse>();
            }

            UserParse user = (UserParse)ParseUser.CurrentUser;
            if (user.Expenses == null)
            {
                user.Expenses = new List<ExpenseParse>();
            }

            ParseUser.CurrentUser.AddToList("Expenses", newExpense);
            selected.AddToList("Expenses", newExpense);
            await ParseUser.CurrentUser.SaveAsync();
            await selected.SaveAsync();
        }
Esempio n. 2
0
        public static void SeedCategories(DoItYourselfDbContext context)
        {
            if (context.Categories.Any())
            {
                return;
            }

            var reader = new StreamReader("C:\\Users\\dsd36\\Desktop\\Do It Yourself\\DoItYourself\\Data\\DoItYourself.Data\\categories.txt");
            var categories = new HashSet<string>();

            using (reader)
            {
                var line = reader.ReadLine();

                while (line != null && line != string.Empty)
                {
                    categories.Add(line);
                    line = reader.ReadLine();
                }

                foreach (var categoryName in categories)
                {
                    var category = new Category()
                    {
                        Name = categoryName,
                        CreatedOn = DateTime.Now
                    };

                    context.Categories.Add(category);
                }
            }

            context.SaveChanges();
        }
        public Category AddCategory(Category toAdd)
        {
            this.categories.Add(toAdd);
            this.categories.SaveChanges();

            return toAdd;
        }
        public ActionResult SaveCategory(Models.Category category)
        {
            int    result  = 0;
            bool   success = false;
            string message = "Error";

            if (ModelState.IsValid)
            {
                result = categoryBLL.AddCategory(category);
                if (result == 1)
                {
                    message = "Category Added Successfully!";
                    success = true;
                }
                else if (result == 2)
                {
                    message = "Category Already Exist! Please give another category name.";
                    success = false;
                }
                else if (result == 0)
                {
                    message = "Category not added!";
                    success = false;
                }
                else
                {
                    message = "error";
                }
            }
            return(Json(new { success = success, responseText = message }, JsonRequestBehavior.AllowGet));
        }
 public void ListViewCategories_InsertItem()
 {
     var newCategory = new Category();
     this.TryUpdateModel(newCategory);
     if (this.ModelState.IsValid)
     {
         this.dbContext.Categories.Add(newCategory);
         this.dbContext.SaveChanges();
     }
 }
        public ActionResult DeleteCategory(Models.Category category)
        {
            int result = categoryBLL.DeleteCategory(category.id);

            if (result == 1)
            {
                return(Json(new { success = true, responseText = "" }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = false, responseText = "Error in Deleting category !" }, JsonRequestBehavior.AllowGet));
        }
 public void InsertCategory(CategoryInsertViewData data)
 {
     Category cat = new Category()
     {
         CategoryName = data.CategoryName,
     };
     catRep.InsertAction(cat);
     context_db.SaveChanges();
     Messenger.NotifyColleagues(MessageTypes.MSG_CATEGORY_INSERTED, data);
 }
Esempio n. 8
0
 private static void SaveChildObjects(ISession dataSession, Category category)
 {
     category.SearchResultLinks.ForEach(r => dataSession.Save(r));
     category.SubCategories.ForEach(r =>
                                        {
                                            r.SubCategories.ForEach(s => dataSession.Save(s));
                                            r.SearchResultLinks.ForEach(s => dataSession.Save(s));
                                            dataSession.Save(r);
                                        });
     dataSession.Save(category);
 }
 public void UpdateCategory(CategoryEditViewData data)
 {
     Category cat = new Category()
     {
         CategoryID = data.CategoryID,
         CategoryName = data.CategoryName,
     };
     catRep.UpdateCategory(cat);
     context_db.SaveChanges();
     Messenger.NotifyColleagues(MessageTypes.MSG_CATEGORY_SAVED, data);
 }
Esempio n. 10
0
        public bool Update(Models.Category category)
        {
            var sqlCommand = new SqlCommand();

            sqlCommand.CommandText =
                $"UPDATE {tableName} SET CategoryName = @CategoryName, Description = @Description WHERE {primaryColumn} = @Id";
            sqlCommand.Parameters.AddWithValue("@Id", category.CategoryID);
            sqlCommand.Parameters.AddWithValue("@CategoryName", category.CategoryName);
            sqlCommand.Parameters.AddWithValue("@Description", category.Description);
            sqlCommand.Connection = _conn;
            return(sqlCommand.ExecuteNonQuery() > 0);
        }
Esempio n. 11
0
        public int Add(Models.Category category)
        {
            var sqlCommand = new SqlCommand
            {
                CommandText =
                    $"INSERT INTO {tableName} (CategoryName, Description) OUTPUT INSERTED.{primaryColumn} VALUES (@CategoryName, @Description)"
            };

            sqlCommand.Parameters.AddWithValue("@CategoryName", category.CategoryName);
            sqlCommand.Parameters.AddWithValue("@Description", category.Description);
            sqlCommand.Connection = _conn;
            var id = sqlCommand.ExecuteScalar();

            return((int?)id ?? -1);
        }
Esempio n. 12
0
        public async Task <ActionResult <CategoriesViewModel> > PostCategory(CategoriesViewModel viewModel)
        {
            var category = new Models.Category()
            {
                Id         = viewModel.Id,
                Title      = viewModel.Title,
                CreateDate = DateTime.Now,
                UrlTitle   = viewModel.Description
            };
            await UnitOfWork.CategoryRepository.Insert(category);

            //_context.People.Add(person);
            await UnitOfWork.SaveAsync();

            return(CreatedAtAction("GetCategory", new { id = viewModel.Id }, viewModel));
        }
        public void Should_get_posts()
        {
            var processor = new CategoriesProcessor();
            var category = new Category { Name = "MyCategory" };
            var posts = new List<Post>
                {
                    new Post{Published = Published.True, Categories = new[]{"MyCategory"}},
                    new Post{Published = Published.Draft, Categories = new[]{"MyCategory"}},
                    new Post{Published = Published.Private, Categories = new[]{"MyCategory"}},
                    new Post{Categories = new[]{"MyCategory1"}},
                };

            var postsFromCategory = processor.GetPosts(posts, category);

            Assert.Equal(1, postsFromCategory.Count());
            Assert.True(postsFromCategory.All(x => x.Published == Published.True));
        }
        public async void AddNewExpenseLocally(string name, string imageUrl, string description, double price, Category category)
        {
            var expense = new Expense
            {
                Name = name,
                Category = category,
                Coast = price,
                Description = description,
                ImageUrl = imageUrl,
                CreatedOn = DateTime.Now,
                UserId = await this.GetUserId()
            };

            this.expenses.Insert(expense);

            var successMessage = new MessageDialog("You successfully added a new expense");
            await successMessage.ShowAsync();
        }
        private void Household_OnChecked(object sender, RoutedEventArgs e)
        {
            if (this.Household.IsChecked.Value)
            {
                var category = Category.Household;
                selected = category;

            }
            else if (this.Lifestyle.IsChecked.Value)
            {
                var category = Category.Lifestyle;
                selected = category;
            }
            else
            {
                var category = Category.Unexpected;
                selected = category;
            }
        }
        public IActionResult Update([FromBody] Models.Category category)
        {
            if (category.Id == 0)
            {
                unitOfWork.Category.Add(category);
            }
            else
            {
                var getDetails = unitOfWork.Category.GetFirstOrDefault(d => d.Id == category.Id);

                if (getDetails == null)
                {
                    return(Ok(false));
                }
                unitOfWork.Category.Update(category);
            }
            unitOfWork.Save();
            return(Ok(true));
        }
        public IHttpActionResult Post(CategoryOutputModel categoryModel)
        {
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest("The model is invalid");
            }

            Category category = new Category();

            category.Name = categoryModel.Name;

            this.data.Categories.Add(category);
            this.data.SaveChanges();

            return this.Ok(new CategoryOutputModel()
            {
                Id = category.Id,
                Name = category.Name
            });
        }
Esempio n. 18
0
        public int AddCategory(Models.Category Category)
        {
            int result = 0;

            using (var db = new Expense_ManagerEntities())
            {
                if (Category.category_name != null)
                {
                    category cat = new category();
                    cat.category_name = Category.category_name;
                    cat.user_id       = Category.user_id;
                    if (IsCategoryExist(cat))
                    {
                        return(2);
                    }
                    db.category.Add(cat);
                    db.SaveChanges();
                    result = 1;
                }
            }
            return(result);
        }
Esempio n. 19
0
        public void Add_Two_New_Categories()
        {
            var prevCategoryCount = data.Categories.All().Count();

            var category = new Category
            {
                Name = "Life style"
            };

            var category2 = new Category
            {
                Name = "Billa bong"
            };

            data.Categories.Add(category2);

            data.Categories.Add(category);

            data.SaveChanges();

            Assert.AreEqual(prevCategoryCount + 2, data.Categories.All().Count());

        }
Esempio n. 20
0
        private void CreateDummyDataIfEmpty(ISession dataSession)
        {
            if (dataSession.CreateCriteria<Category>().List<Category>().Any()) return;
            using (var tx = dataSession.BeginTransaction())
            {
                const string smallOrgSize = "org_size:1to5,";
                const string mediumOrgSize = "org_size:6to25,";
                const string largeOrgSize = "org_size:26plus,";
                const string proficiencyNovice = "user_prof:novice,";
                const string proficiencyIntermediate = "user_prof:intermediate,";
                const string proficiencyExpert = "user_prof:expert,";
                const string promoted = "promoted,";

                #region Category Getting Started with IT

                var category = new Category
                                   {
                                       Title = "Getting Started with IT",
                                       Blurb = "When you're not an IT professional, where to start with IT can be a daunting question. Like all things, a bit of research never goes amiss.",
                                       Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                proficiencyNovice +
                                                promoted +
                                                "GettingStarted").WrapCommas(),
                                       SearchResultLinks = new List<SearchResultLink>
                                                               {
                                                                   new SearchResultLink
                                                                       {
                                                                           Title = "How do I Plan and budget for IT equipment?",
                                                                           Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                    proficiencyNovice + proficiencyIntermediate +
                                                                                    promoted +
                                                                                    "GettingStarted,ITEquipment").WrapCommas()
                                                                       },
                                                                   new SearchResultLink
                                                                       {
                                                                           Title = "Choosing and using consultants",
                                                                           Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                    proficiencyNovice + proficiencyIntermediate + proficiencyExpert +
                                                                                    promoted +
                                                                                    "GettingStarted,Consultants").WrapCommas()
                                                                       },
                                                                   new SearchResultLink
                                                                       {
                                                                           Title = "Making Decisions On ICT: Roles And Responsibilities",
                                                                           Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                    proficiencyNovice +
                                                                                    promoted +
                                                                                    "GettingStarted,Roles,Responsibilities").WrapCommas()
                                                                       }
                                                               },
                                       SubCategories = new List<Category>
                                                           {/*
                                                               new Category
                                                                   {
                                                                       Title = "Technology Planning and Strategy",
                                                                       Blurb = "A technology plan can sound like another piece of bureaucracy. Don't be fooled! There is no substitute for thinking through what you need and how you will meet those needs. Technology planning is the process that will help you save money on technology, buy what you need and use technology as a tool to accomplish your organisation's mission.",
                                                                       Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                    proficiencyNovice +
                                                                                    promoted +
                                                                                    "GettingStarted,Strategy").WrapCommas(),
                                                                       SearchResultLinks = new List<SearchResultLink> {
                                                                                    new SearchResultLink
                                                                                    {
                                                                                        Title = "What can IT do for me?",
                                                                                        Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                                proficiencyNovice +
                                                                                                promoted +
                                                                                                "GettingStarted,Strategy,Infrastructure,Planning").WrapCommas()
                                                                                    },
                                                                                    new SearchResultLink
                                                                                    {
                                                                                        Title = "Case Studies",
                                                                                        Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                                proficiencyNovice +
                                                                                                promoted +
                                                                                                "GettingStarted,CaseStudies").WrapCommas()
                                                                                    },
                                                                                    new SearchResultLink
                                                                                    {
                                                                                        Title = "Project Planning",
                                                                                        Tags = (smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                                proficiencyNovice +
                                                                                                promoted +
                                                                                                "GettingStarted,ProjectPlanning").WrapCommas()
                                                                                    }
                                                                       },
                                                                       SubCategories = new List<Category> {}
                                                                   }
                                                           */}
                                   };
                SaveChildObjects(dataSession, category);

                #endregion

                #region Category Payment Solutions

                category = new Category
                               {
                                   Title = "Payment Solutions",
                                   Blurb = "Online fundraising is now an integral part of the fundraising mix. Not-for-profit organisations wanting to maximise their income, must be able to offer the full range of payment options.",
                                   Tags = "Payments",
                                   SearchResultLinks =
                                       new List<SearchResultLink>
                                           {
                                               new SearchResultLink {Title = "Web Online Payments", Tags = smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                                            proficiencyNovice + proficiencyIntermediate +
                                                                                                            promoted +
                                                                                                            "Payments,Online"},
                                               new SearchResultLink {Title = "Chip & Pin Terminals", Tags = smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                                            proficiencyNovice + proficiencyIntermediate + proficiencyExpert +
                                                                                                            promoted +
                                                                                                            "Payments,ChipAndPin"},
                                               new SearchResultLink {Title = "Security of PCI-DSS Payment Card Industry Data", Tags = smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                                            proficiencyNovice + proficiencyIntermediate + proficiencyExpert +
                                                                                                            promoted +
                                                                                                            "Payments,PCI-DSS,Security"}
                                           },
                                   SubCategories =
                                       new List<Category>
                                           {/*
                                               new Category
                                                   {
                                                       Title = "Direct Debit Services",
                                                       Blurb =
                                                           "Direct Debit is an essential tool for charities seeking regular gifts either online or via telephone fundraising campaigns",
                                                       Tags = "Payments, DirectDebit",
                                                       SearchResultLinks = new List<SearchResultLink> { new SearchResultLink {Title = "What are Online Direct Debits?",
                                                                                                            Tags = smallOrgSize + mediumOrgSize + largeOrgSize +
                                                                                                            proficiencyNovice +
                                                                                                            promoted +
                                                                                                            "Payments,DirectDebit,Online"},
                                                                                                        new SearchResultLink {Title = "Direct Debit Bureau Services",
                                                                                                            Tags = mediumOrgSize + largeOrgSize +
                                                                                                            proficiencyNovice + proficiencyIntermediate + proficiencyExpert +
                                                                                                            promoted +
                                                                                                            "Payments,DirectDebit,Bureau"},
                                                                                                        new SearchResultLink {Title = "Direct Debit Facilities Management",
                                                                                                            Tags = mediumOrgSize + largeOrgSize +
                                                                                                            proficiencyNovice + proficiencyIntermediate + proficiencyExpert +
                                                                                                            promoted +
                                                                                                            "Payments,DirectDebit,Facilities"}
                                                       },
                                                       SubCategories = new List<Category> {}
                                                   }
                                           */}
                               };
                SaveChildObjects(dataSession, category);

                #endregion

                #region Category EMail

                category = new Category
                               {
                                   Title = "Email",
                                   Blurb = "Connecting to the Internet will allow you better access to information and better communication with members and other partners through the use of email.",
                                   Tags = smallOrgSize + mediumOrgSize + largeOrgSize +
                                            proficiencyNovice +
                                            "Email",
                                   SearchResultLinks =
                                       new List<SearchResultLink>
                                           {
                                                   new SearchResultLink
                                                   {
                                                       Title = "Choosing An Internet Service Provider",
                                                       Tags =  smallOrgSize + mediumOrgSize + largeOrgSize +
                                                               proficiencyNovice + proficiencyIntermediate +
                                                               promoted +
                                                               "Email,ISP"
                                                   },
                                                   new SearchResultLink
                                                   {
                                                       Title = "Email in the Cloud: A Google Apps Case Study",
                                                       Tags =  smallOrgSize + mediumOrgSize + largeOrgSize +
                                                               proficiencyNovice + proficiencyIntermediate + proficiencyExpert +
                                                               promoted +
                                                               "Email,Cloud,Google,CaseStudy"
                                                   },
                                                   new SearchResultLink
                                                   {
                                                       Title = "Using Email Marketing",
                                                       Tags =  smallOrgSize + mediumOrgSize + largeOrgSize +
                                                               proficiencyNovice + proficiencyIntermediate +
                                                               promoted +
                                                               "Email,Marketing"
                                                   }
                                           },
                                   SubCategories = new List<Category>
                                                       {/*
                                                           new Category
                                                               {
                                                                   Title = "Using Broadband",
                                                                   Blurb =
                                                                       "As greater numbers of people connect to broadband those left without a service are increasingly struggling to keep up.  In the voluntary and community sector large numbers of people work from home and a slow internet connection can seriously hamper productivity.",
                                                                   Tags = "Email,Broadband",
                                                                   SearchResultLinks = new List<SearchResultLink> {},
                                                                   SubCategories = new List<Category> {}
                                                               },
                                                           new Category
                                                               {
                                                                   Title = "Building And Designing Email Newsletters",
                                                                   Blurb =
                                                                       "Different Email Clients (Outlook, Hotmail, Yahoo!, AOL, Gmail) display email slightly differently, and many of them are dependant on the web browser the user has chosen. So how do we build and design emails to fit across all systems?",
                                                                   Tags = "Email,Newsletters",
                                                                   SearchResultLinks = new List<SearchResultLink> {},
                                                                   SubCategories = new List<Category> {}
                                                               }
                                                       */}
                               };
                SaveChildObjects(dataSession, category);

                #endregion

                tx.Commit();
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 获取栏目文件路径,如news/us
        /// </summary>
        /// <param name="categoryID"></param>
        /// <returns></returns>
        public static string GetCategoryUrlPath(Category category)
        {
            StringBuilder sb = new StringBuilder();

            IList<Category> categories = new List<Category>(categoryBLL.GetCategories(category.Lft, category.Rgt,CategoryContainerOption.Parents));

            foreach (Category c in categories)
            {
                sb.Append(c.Tag).Append("/");
            }
            sb.Append(category.Tag);
            return sb.ToString();
        }
        public async Task<bool> Update(Category category)
        {
            var sql = $"UPDATE {Db} SET Name = @Name, ParentId = @ParentId WHERE Id = @Id;";

            return await Execute(sql, category);
        }
        public async Task<bool> Create(Category category)
        {
            var sql = $"INSERT INTO {Db} (Name, ParentId) VALUES (@Name, @ParentId);";

            return await Execute(sql, category);
        }
Esempio n. 24
0
 internal IEnumerable<Post> GetPosts(IList<Post> files, Category category)
 {
     return files.Where(x => x.Categories.Contains(category.Name)).Where(ShouldProcess.Category);
 }
Esempio n. 25
0
 internal static bool ShouldProcess(Category category)
 {
     return category.Count > 0;
 }
Esempio n. 26
0
 public PartialViewResult _StyleBeerList(Category category)
 {
     return PartialView(category);
 }
 public async Task<IHttpActionResult> Update(int id, Category category)
 {
     if (await _categoriesService.Update(category))
         return Ok(category);
     return BadRequest();
 }
Esempio n. 28
0
 public async Task<bool> Update(Category category)
 {
     return Category.IsValid(category) && await _categoriesRepository.Update(category);
 }
Esempio n. 29
0
        protected override void Seed(StoreDbContext db)
        {
            var catElectro = new Category {
                Name = "Electro"
            };

            db.Categories.Add(catElectro);
            db.Categories.Add(new Category {
                Name = "Old"
            });
            var catSport = new Category {
                Name = "Sport"
            };

            db.Categories.Add(catSport);

            var vendorXiaomi = new Vendor {
                Name = "Xiaomi"
            };

            db.Vendors.Add(vendorXiaomi);
            var vendorComanche = new Vendor {
                Name = "Comanche"
            };

            db.Vendors.Add(vendorComanche);

            db.Products.Add(new Product {
                Name     = "Uma Mini", Description = "Dont buy this",
                Vendor   = vendorXiaomi, Price = 15000,
                Category = catElectro
            });
            db.Products.Add(new Product
            {
                Name        = "C1",
                Description = "Dont buy this",
                Price       = 10000,
                Vendor      = vendorXiaomi,
                Category    = catElectro
            });
            db.Products.Add(new Product
            {
                Name        = "QBike",
                Description = "Dont buy this",
                Price       = 17000,
                Vendor      = vendorXiaomi,
                Category    = catElectro
            });
            db.Products.Add(new Product
            {
                Name        = "M17",
                Price       = 12000,
                Description = "asda",
                Vendor      = vendorComanche,
                Category    = catSport
            });
            db.Products.Add(new Product
            {
                Name        = "M19",
                Price       = 15000,
                Description = "fdas",
                Vendor      = vendorComanche,
                Category    = catSport
            });
            db.Products.Add(new Product
            {
                Name        = "M19",
                Price       = 20000,
                Description = "fdas",
                Vendor      = vendorComanche,
                Category    = catSport
            });
            db.Products.Add(new Product
            {
                Name        = "PRARIE 17",
                Price       = 30000,
                Description = "fdas",
                Vendor      = vendorComanche,
                Category    = catSport
            });
            db.Products.Add(new Product
            {
                Name        = "PRARIE 19",
                Price       = 10000,
                Description = "fdas",
                Vendor      = vendorComanche,
                Category    = catSport
            });
            db.Products.Add(new Product
            {
                Name        = "PRARIE M17",
                Price       = 31000,
                Description = "fdas",
                Vendor      = vendorComanche,
                Category    = catSport
            });
            db.Products.Add(new Product
            {
                Name        = "ONTARIO M19",
                Description = "fdas",
                Price       = 45000,
                Vendor      = vendorComanche,
                Category    = catSport
            });


            db.Users.Add(new User
            {
                Name     = "Admin",
                Email    = "*****@*****.**",
                Password = "******"
            });

            base.Seed(db);
        }
Esempio n. 30
0
 public CategoryDTO(Category category)
 {
     this.Name = category.Name;
 }
Esempio n. 31
0
        public int AddCategory(Models.Category CategoryName)
        {
            int result = categoryDAL.AddCategory(CategoryName);

            return(result);
        }
Esempio n. 32
0
        private void SaveCategoryToCategorableEntity(ICategorableEntity tagableEntity, Category dbCategory)
        {
            // Should make it more Generic!!!!
            //var type = tagableEntity.GetType();
            //this.Data.GetDeletableEntityRepository<tagableEntity as de>()

            var entityIsAlbum = tagableEntity as Album;
            if (entityIsAlbum != null)
            {
                var album = this.Data.Albums.GetById(entityIsAlbum.Id);
                album.Categories.Add(dbCategory);
                this.Data.Albums.Update(album);
                dbCategory.Albums.Add(album);
            }
            var entityIsArticle = tagableEntity as Article;
            if (entityIsArticle != null)
            {
                var article = this.Data.Articles.GetById(entityIsArticle.Id);
                article.Categories.Add(dbCategory);
                this.Data.Articles.Update(article);
                dbCategory.Articles.Add(article);
            }
            this.Data.Categories.Update(dbCategory);
            this.Data.SaveChanges();
        }
Esempio n. 33
0
 public static bool Category(Category category)
 {
     return category.Count > 0;
 }
 public void Update(Category toUpdate)
 {
     this.categories.Update(toUpdate);
     this.categories.SaveChanges();
 }
Esempio n. 35
0
        public IHttpActionResult AddCategory(CategoryBindingModel categoryModel)
        {
            if (!ModelState.IsValid)
            {
                return this.BadRequest("Invalid category binding model");
            }

            var category = new Category
            {
                Name = categoryModel.Name
            };

            if (Data.Categories.All().FirstOrDefault(c => c.Name == category.Name) != null)
            {
                return BadRequest(string.Format("Category {0} allready exists in the db", category.Name));
            }

            this.Data.Categories.Add(category);
            this.Data.SaveChanges();

            return this.Ok(string.Format("Category {0} added", category.Name));
        }