public async Task <IActionResult> OnPostAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

            if (uid == null)
            {
                return(RedirectToPage("../../Index"));
            }

            if (id == null)
            {
                return(NotFound());
            }

            TblEmployeeRequestUserMilitary = await _context.TblEmployeeRequestUserMilitaries.FindAsync(id);

            if (TblEmployeeRequestUserMilitary != null)
            {
                _context.TblEmployeeRequestUserMilitaries.Remove(TblEmployeeRequestUserMilitary);

                TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog()
                {
                    FldEmployeeRequestEmployeeEditLogDate = DateTime.Now,
                    FldEmployeeRequestUserId                 = Int64.Parse(uid),
                    FldEmployeeRequestEmployeeId             = TblEmployeeRequestUserMilitary.FldEmployeeRequestEmployeeId,
                    FldEmployeeRequestEmployeeEditLogSection = "Military-Delete"
                };

                _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("Index", new { id = TblEmployeeRequestUserMilitary.FldEmployeeRequestEmployeeId }));
        }
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

            if (uid == null)
            {
                return(RedirectToPage("../../Index"));
            }

            if (id == null)
            {
                return(NotFound());
            }

            TblEmployeeRequestUserMilitary = await _context.TblEmployeeRequestUserMilitaries
                                             .Include(t => t.FldEmployeeRequestEmployee)
                                             .Include(t => t.FldEmployeeRequestMilitary)
                                             .Include(t => t.FldEmployeeRequestMilitaryOrganization).FirstOrDefaultAsync(m => m.FldEmployeeRequestUserMilitaryId == id);

            if (TblEmployeeRequestUserMilitary == null)
            {
                return(NotFound());
            }
            ViewData["FldEmployeeRequestMilitaryId"]             = new SelectList(_context.TblEmployeeRequestMilitaries, "FldEmployeeRequestMilitaryId", "FldEmployeeRequestMilitaryMilitaryStatus");
            ViewData["FldEmployeeRequestMilitaryOrganizationId"] = new SelectList(_context.TblEmployeeRequestMilitaryOrganizations, "FldEmployeeRequestMilitaryOrganizationId", "FldEmployeeRequestMilitaryOrganizationOrganizationName");
            ViewData["startdate"] = TblEmployeeRequestUserMilitary.FldEmployeeRequestUserMilitaryStartDate.toPersianDate();
            ViewData["enddate"]   = TblEmployeeRequestUserMilitary.FldEmployeeRequestUserMilitaryEndDate.toPersianDate();
            return(Page());
        }
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

            if (uid == null)
            {
                return(RedirectToPage("../../Index"));
            }

            if (id == null)
            {
                return(NotFound());
            }

            TblEmployeeRequestUserMilitary = await _context.TblEmployeeRequestUserMilitaries
                                             .Include(t => t.FldEmployeeRequestEmployee)
                                             .Include(t => t.FldEmployeeRequestMilitary)
                                             .Include(t => t.FldEmployeeRequestMilitaryOrganization).FirstOrDefaultAsync(m => m.FldEmployeeRequestUserMilitaryId == id);

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