Ejemplo n.º 1
0
 public IActionResult IKDDSForm(IKDDSModel ikddsmodel)
 {
     if (!ModelState.IsValid)
     {
         return(View("New"));
     }
     if (ikddsmodel.RpsNumber != null)
     {
         ikddsmodel.FinalData = ikddsmodel.EntryData.AddDays(30);
         //ikddsmodel.InvestigationType.Type;
     }
     else if (ikddsmodel.RsdNumber != null)
     {
         ikddsmodel.FinalData = ikddsmodel.EntryData.AddDays(60);
         // ikddsmodel.InvestigationType.Type = "RSD";
     }
     else if ((ikddsmodel.RpsNumber != null) && (ikddsmodel.RsdNumber != null))
     {
         ikddsmodel.FinalData = ikddsmodel.EntryData.AddDays(60);
         //ikddsmodel.InvestigationType.Type = "RPS/RSD";
     }
     ikddsmodel.AddedInSystem = DateTime.Now;
     ikddsmodel.OZDate        = null;
     ikddsmodel.RealEndDate   = null;
     _context.IKDDSModels.Add(ikddsmodel);
     _context.SaveChanges();
     return(RedirectToAction("MainTable", "Summary"));
 }
Ejemplo n.º 2
0
        public IActionResult Save(IKDDSModel ikddsmodel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Edit"));
            }

            var toUpdate = _context.IKDDSModels.SingleOrDefault(t => t.Id == ikddsmodel.Id);


            toUpdate.OfficerName          = ikddsmodel.OfficerName;
            toUpdate.RpsNumber            = ikddsmodel.RpsNumber;
            toUpdate.RsdNumber            = ikddsmodel.RsdNumber;
            toUpdate.EntryData            = ikddsmodel.EntryData;
            toUpdate.FinalData            = ikddsmodel.FinalData;
            toUpdate.FinalOfInvestigation = ikddsmodel.FinalOfInvestigation;
            toUpdate.IKDDS         = ikddsmodel.IKDDS;
            toUpdate.OZDate        = ikddsmodel.OZDate;
            toUpdate.ArticleNumber = ikddsmodel.ArticleNumber;
            toUpdate.RealEndDate   = ikddsmodel.RealEndDate;

            _context.SaveChanges();
            var invest = _context.IKDDSModels.Include(x => x.InvestigationType).ToList();


            var viewModel = new MainTableViewModel
            {
                IKDDSModels = invest,
            };

            return(View("MainTable", viewModel));
        }