Example #1
0
        public async Task <int> CreateCheck()
        {
            Check check = new Check();

            check.Date = DateTime.Now;
            _context.Add(check);
            await _context.SaveChangesAsync();

            return(check.Id);
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Price")] Ingredient ingredient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ingredient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ingredient));
        }
        public async Task <IActionResult> Create([Bind("Id,Name")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("ID,Description,Title,Value,CreationData,DueData,PayData")] Register register)
        {
            if (ModelState.IsValid)
            {
                _context.Add(register);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(register));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,Price,Piece,CategoryId")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", product.CategoryId);
            return(View(product));
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("Id,ProductId,IngredientId,Quantity")] ProductIngredient productIngredient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productIngredient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IngredientId"] = new SelectList(_context.Ingredient, "Id", "Name", productIngredient.IngredientId);
            ViewData["ProductId"]    = new SelectList(_context.Product, "Id", "Name", productIngredient.ProductId);
            return(View(productIngredient));
        }
        public async Task <IActionResult> Create([Bind("Id,CheckId,ProductId,Quantity")] CheckProduct checkProduct)
        {
            if (ModelState.IsValid)
            {
                _context.Add(checkProduct);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CheckId"]   = new SelectList(_context.Check, "Id", "Id", checkProduct.CheckId);
            ViewData["ProductId"] = new SelectList(_context.Product, "Id", "Name", checkProduct.ProductId);
            return(View(checkProduct));
        }
Example #8
0
 public void AddNewClass(ClassDTO newClass)
 {
     registerContext.Add(AutoMapper.Mapper.Map <ClassDTO, Class>(newClass));
     registerContext.SaveChanges();
 }