Ejemplo n.º 1
0
        public ActionResult Save(ClaimModel claimModel)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new ClaimsFormViewModel
                {
                    TyeOfClaims  = _context.TyeOfClaims.ToList(),
                    TypesOfForms = _context.TypesOfForms.ToList(),
                    ClaimModel   = claimModel
                };
                return(View("ClaimForm", viewModel));
            }

            if (claimModel == null)
            {
                return(HttpNotFound());
            }
            //Add the data into Context object
            _context.ClaimModels.Add(claimModel);

            // Save the data into the database
            _context.SaveChanges();

            // Return to Home when data save successfully.
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            //geting the View model for Adding list to the form

            var viewModel = new ClaimsFormViewModel
            {
                TyeOfClaims  = _context.TyeOfClaims.ToList(),
                TypesOfForms = _context.TypesOfForms.ToList(),
                ClaimModel   = new ClaimModel()
            };

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