Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            CategoryLogic db = new CategoryLogic();

            this.categories = db.GetAllCategories();
            foreach (Category category in categories)
            {
                cboxCategory.Items.Add(category.Name);
            }
        }
        public EditQuestion(Question question)
        {
            InitializeComponent();
            _question         = question;
            tbContentOld.Text = _question.Content;
            tbSubjectOld.Text = _question.Title;

            foreach (Category category in db.GetAllCategories())
            {
                cmbCategory.Items.Add(category.Name);
            }
        }
Exemplo n.º 3
0
        public IActionResult AddExpenseToCategory(AddNewExpenseViewModel model)
        {
            List <Category> _categories = _CLogic.GetAllCategories();

            model.Categories = _categories;

            if (model.CategoryId != Guid.Empty)
            {
                _CLogic.AddExpenseToCategory(model.CategoryId, model.ExpenseId);
                return(RedirectToAction("Succes", model));
            }
            return(View(model));
        }
        public void GetCategories_IsValid()
        {
            using (AutoMock mock = AutoMock.GetLoose())
            {
                mock.Mock <ICategoryContext>()
                .Setup(x => x.GetAllCategories())
                .Returns(GetSampleCategory());

                CategoryLogic   cls      = mock.Create <CategoryLogic>();
                List <Category> expected = GetSampleCategory();

                List <Category> actual = cls.GetAllCategories();

                Assert.IsTrue(actual != null);
                Assert.AreEqual(expected.Count, actual.Count);
            }
        }
 public IActionResult GetCategories()
 {
     try
     {
         var    categories = categoryLogic.GetAllCategories();
         string doi        = JsonConvert.SerializeObject(categories);
         byte[] encrypted  = encryptDecrypt.EncryptStringToBytes_Aes(doi);
         //var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(original);
         //var pts =  System.Convert.ToBase64String(plainTextBytes);
         //Console.WriteLine(pts);
         return(Ok(encrypted));
     }
     catch (Exception e)
     {
         return(NotFound(e));
     }
 }
Exemplo n.º 6
0
 public void GetUserForms_Test()
 {
     Assert.AreEqual(3, _categoryLogic.GetAllCategories().Count);
 }
Exemplo n.º 7
0
 public ActionResult Edit(int id)
 {
     ViewData["Categories"] = _categoryLogic.GetAllCategories();
     return(View("../CareRecipient/Question/Edit", new QuestionViewModel(_questionLogic.GetSingleQuestion(id))));
 }
Exemplo n.º 8
0
        public List <CategoryJson> Get()
        {
            var categories = categoryLogic.GetAllCategories();

            return(categories);
        }