Пример #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            // Solved
            // Need to figure out what we're missing to get the already set DateTime to pass.
            // remove if we get 'date created' to work.
            //DeskQuote.DeskQuoteDate = DateTime.Now;
            // call Quote Total Function from model
            DeskQuote.CalculateQuote();

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DeskQuoteExists(DeskQuote.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("../Index"));
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            // call Quote Total Function from model
            DeskQuote.DeskQuoteDate = DateTime.Now;
            DeskQuote.CalculateQuote();

            _context.DeskQuote.Add(DeskQuote);
            await _context.SaveChangesAsync();

            return(RedirectToPage("../Index"));
        }
Пример #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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