示例#1
0
        OnPostAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

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

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

            TblEmployeeRequestPrimaryInformation = await _context.TblEmployeeRequestPrimaryInformations.FindAsync(id);

            if (TblEmployeeRequestPrimaryInformation != null)
            {
                _context.TblEmployeeRequestPrimaryInformations.Remove(TblEmployeeRequestPrimaryInformation);

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

                _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("Index", new { id = TblEmployeeRequestPrimaryInformation.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());
            }

            TblEmployeeRequestPrimaryInformation = await _context.TblEmployeeRequestPrimaryInformations
                                                   .Include(t => t.FldEmployeeRequestEmployee).FirstOrDefaultAsync(m => m.FldEmployeeRequestPrimaryInformationId == id);

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

            ViewData["birthdate"] = TblEmployeeRequestPrimaryInformation.FldEmployeeRequestPrimaryInformationBirthDate.toPersianDate();

            return(Page());
        }
示例#3
0
        OnGetAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

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

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

            TblEmployeeRequestPrimaryInformation = await _context.TblEmployeeRequestPrimaryInformations
                                                   .Include(t => t.FldEmployeeRequestEmployee).FirstOrDefaultAsync(m => m.FldEmployeeRequestPrimaryInformationId == id);

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