public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(BinaryMultiplication).State = EntityState.Modified;

            try
            {
                BinaryMultiplication.MultiplicationResult = BinaryMultiplication.EvaluateBinaryMultiplication(BinaryMultiplication.Operand1, BinaryMultiplication.Operand2);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BinaryMultiplicationExists(BinaryMultiplication.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
예제 #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            BinaryNegation.NegationResult = BinaryNegation.EvaluateBinaryNegation(BinaryNegation.Operand);
            _context.BinaryNegation.Add(BinaryNegation);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            BinaryNegation = await _context.BinaryNegation.FindAsync(id);

            if (BinaryNegation != null)
            {
                _context.BinaryNegation.Remove(BinaryNegation);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }