OnPostAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

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

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

            TblWorkExperience = await _context.TblWorkExperiences.FindAsync(id);

            if (TblWorkExperience != null)
            {
                _context.TblWorkExperiences.Remove(TblWorkExperience);

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

                _context.TblEmployeeRequestEmployeeEditLogs.Add(t);

                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("Index", new { id = TblWorkExperience.UserId }));
        }
Beispiel #2
0
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

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

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

            TblWorkExperience = await _context.TblWorkExperiences
                                .Include(t => t.FldLeaveJob)
                                .Include(t => t.FldTaminJob)
                                .Include(t => t.User).FirstOrDefaultAsync(m => m.FldWorkExperienceId == id);

            if (TblWorkExperience == null)
            {
                return(NotFound());
            }
            ViewData["FldLeaveJobId"] = new SelectList(_context.TblLeaveJobs, "FldLeaveJobId", "FldLeaveJobTitle");
            ViewData["FldTaminJobId"] = new SelectList(_context.TblJobTamins.Where(a => a.FldTaminJobId == TblWorkExperience.FldTaminJobId), "FldTaminJobId", "FldTaminJobName");
            ViewData["startdate"]     = TblWorkExperience.FldStartDate.toPersianDate();
            ViewData["enddate"]       = TblWorkExperience.FldEndDate.toPersianDate();

            return(Page());
        }
        OnGetAsync(long?id)
        {
            string uid = HttpContext.Session.GetString("uid");

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

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

            TblWorkExperience = await _context.TblWorkExperiences
                                .Include(t => t.FldLeaveJob)
                                .Include(t => t.FldTaminJob)
                                .Include(t => t.User).FirstOrDefaultAsync(m => m.FldWorkExperienceId == id);

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