예제 #1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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

            getArea();
            getDrawerCost();
            getMaterialCost();
            getRushCost();
            getTotalCost();

            Desk.Date = DateTime.Now.ToString("MM/dd/yyyy");

            _context.DeskModel.Add(Desk);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
예제 #3
0
        // 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());
            }

            getArea();
            getDrawerCost();
            getMaterialCost();
            getRushCost();
            getTotalCost();


            //*****Save****//
            _context.Attach(Desk).State = EntityState.Modified;

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

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