Exemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TblTimeSheetEntry = await _context.TblTimeSheetEntry.FirstOrDefaultAsync(m => m.TimesheetID == id);

            if (TblTimeSheetEntry == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            if (HttpContext.Session.GetString("userid") == null)
            {
                return(RedirectToPage("/Login/Index"));
            }

            TblTimeSheetEntry = await _context.TblTimeSheetEntry.FirstOrDefaultAsync(m => m.TimesheetID == id);

            if (TblTimeSheetEntry == null)
            {
                return(NotFound());
            }
            else
            {
                TblTimeSheetEntry.Status = "REJECT";
//                TblTimeSheetEntry.ApproveDate = DateTime.Now;
                _context.Attach(TblTimeSheetEntry).State = EntityState.Modified;

                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TblTimeSheetEntryExists(TblTimeSheetEntry.TimesheetID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(RedirectToPage("./Index"));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            if (HttpContext.Session.GetString("userid") == null)
            {
                return(RedirectToPage("/Login/Index"));
            }

            PopulateProject();

            TblTimeSheetEntry = await _context.TblTimeSheetEntry.FirstOrDefaultAsync(m => m.TimesheetID == id);

            if (TblTimeSheetEntry == null)
            {
                return(NotFound());
            }
            return(Page());
        }