// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClientExists(Client.ClientID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            var FormatRateDB = _context.Formats
                               .Single(b => b.FormatID == Calculation.FormatID);

            var ColourfulnessRateDB = _context.Colourfulnesses
                                      .Single(b => b.ColourfulnessID == Calculation.ColourfulnessID);

            var PaperRateDB = _context.Papers
                              .Single(b => b.PaperID == Calculation.PaperID);
            var perem = Calculation.Discount;

            Calculation.TotalCost = Calculation.TotalPages * FormatRateDB.FormatRate * ColourfulnessRateDB.ColourfulnessRate *
                                    PaperRateDB.PaperCost;

            if (Calculation.Discount > 0)
            {
                Calculation.TotalCost = Calculation.TotalCost - Calculation.TotalCost * (Calculation.Discount / 100);
            }
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CalculationExists(Calculation.CalculationID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

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