Beispiel #1
0
        public IActionResult Show(ExchangesModel exchanges)
        {
            var viewModel = new ExchangesAddViewModel
            {
                NumberOfCharsInName        = exchanges.Name.Length,
                NumberOfCharsInDescription = exchanges.Description.Length,
                IsHidden = !exchanges.IsVisible
            };

            return(View("ExchangesAdded", viewModel));
        }
        public IActionResult AddItem(ExchangesModel exchange)
        {
            var entity = new ItemEntity
            {
                Name        = exchange.Name,
                Description = exchange.Description,
                IsVisible   = exchange.IsVisible,
            };

            _dbContext.Items.Add(entity);
            _dbContext.SaveChanges();
            return(Ok());
        }
        public Ajax Post(ExchangesModel exchange)
        {
            var res = new Ajax();

            res.success = true;

            var entity = new ItemEntity
            {
                Name        = exchange.Name,
                Description = exchange.Description,
                IsVisible   = exchange.IsVisible,
            };

            _dbContext.Items.Add(entity);
            _dbContext.SaveChanges();


            return(res);
        }