Beispiel #1
0
        public async Task <Object> Create([FromBody] Class getClass)
        {
            _context.Class.Add(getClass);
            await _context.SaveChangesAsync();

            return(Ok(getClass));
        }
Beispiel #2
0
        public async Task <int> CreateCheck()
        {
            Check check = new Check();

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

            return(check.Id);
        }
        //[ValidateAntiForgeryToken]
        public async Task <Object> Create([FromBody] Student student)
        {
            student.StudentId = Guid.NewGuid();
            _context.Student.Add(student);
            await _context.SaveChangesAsync();

            ViewData["ClassId"] = new SelectList(_context.Class, "ClassId", "ClassId", student.ClassId);

            return(Ok(student));
        }
        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));
        }
Beispiel #5
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));
        }
Beispiel #6
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));
        }
        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));
        }
Beispiel #8
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));
        }