public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            OvertimeFormMain = await _context.OvertimeFormMain.SingleOrDefaultAsync(m => m.Y == id);

            if (OvertimeFormMain == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #2
0
        public async Task <IActionResult> OnGetAsync(int?Y, int?M, int?D)
        {
            if (Y == null || M == null || D == null)
            {
                return(NotFound());
            }

            OvertimeFormMain = await _context.OvertimeFormMain.SingleOrDefaultAsync(m => m.Y == Y && m.M == M && m.D == D);

            if (OvertimeFormMain == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #3
0
        public async Task <IActionResult> OnPostAsync(int?Y, int?M, int?D)
        {
            if (Y == null || M == null || D == null)
            {
                return(NotFound());
            }

            OvertimeFormMain = await _context.OvertimeFormMain.FindAsync(Y, M, D);

            if (OvertimeFormMain != null)
            {
                var OvertimeFormDetails = _context.OvertimeFormDetails.Where(d => d.ExcelServerRcid == OvertimeFormMain.ExcelServerRcid);
                var repCase             = _context.EsRepCase.Where(r => r.RcId == OvertimeFormMain.ExcelServerRcid);
                _context.OvertimeFormMain.Remove(OvertimeFormMain);
                _context.OvertimeFormDetails.RemoveRange(OvertimeFormDetails);
                _context.EsRepCase.RemoveRange(repCase);

                await _context.SaveChangesAsync();
            }

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