Exemplo n.º 1
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            PersonnelFile.Id = _pinhuaContext.CreatePersonnelFileId("PF", 4);

            var rcId    = _pinhuaContext.GetNewRcId();
            var rtId    = _pinhuaContext.GetRtId("人员档案");
            var repCase = new EsRepCase
            {
                RcId          = rcId,
                RtId          = rtId,
                LstFiller     = 2,
                LstFillerName = User.Identity.Name,
                LstFillDate   = DateTime.Now,
                FillDate      = DateTime.Now,
            };

            PersonnelFile.ExcelServerRcid = rcId;
            PersonnelFile.ExcelServerRtid = rtId;
            PersonnelFile.SignedDate      = DateTime.Now;

            _pinhuaContext.EsRepCase.Add(repCase);
            _pinhuaContext.人员档案.Add(_mapper.Map <PersonnelFilesDTO, 人员档案>(PersonnelFile));
            _pinhuaContext.SaveChanges();

            return(RedirectToPage("Index"));
        }