예제 #1
0
        public ActionResult InsurerDetails(int id)
        {
            var svc   = new InsurerService();
            var model = svc.GetInsurerByID(id);

            return(View(model));
        }
예제 #2
0
        // GET: Insurer
        public ActionResult Index()
        {
            var service = new InsurerService();
            var model   = service.GetInsurers();

            ViewBag.TotalCount = model.ToList().Count();
            return(View(model));
        }
예제 #3
0
        public ActionResult DeleteInsurer(int id)
        {
            var service = new InsurerService();

            service.DeleteInsurer(id);

            TempData["Save Result"] = ("The insurer was removed");
            return(RedirectToAction("Index"));
        }
예제 #4
0
        public ActionResult InsurerEdit(int id)
        {
            var svc    = new InsurerService();
            var detail = svc.GetInsurerByID(id);
            var model  =
                new InsurerEdit
            {
                InsurerID   = detail.InsurerID,
                Name        = detail.Name,
                Email       = detail.Email,
                Address     = detail.Address,
                PhoneNumber = detail.PhoneNumber,
                Type        = detail.Type
            };

            return(View(model));
        }
예제 #5
0
        public ActionResult InsurerCreate(InsurerCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = new InsurerService();

            if (service.InsurerCreate(model))
            {
                TempData["SaveResult"] = "The insurer was created.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "The insurer could not be created.");
            return(View(model));
        }
        public PolicyDetail ProductDetail()
        {
            var model      = new PolicyDetailModel();
            var InsService = new InsurerService();

            model.CurrencyId       = InsuranceContext.Currencies.All().FirstOrDefault().Id;
            model.PolicyStatusId   = InsuranceContext.PolicyStatuses.All().FirstOrDefault().Id;
            model.BusinessSourceId = InsuranceContext.BusinessSources.All().FirstOrDefault().Id;
            //model.Products = InsuranceContext.Products.All().ToList();
            model.InsurerId = InsService.GetInsurers().FirstOrDefault().Id;
            var objList = InsuranceContext.PolicyDetails.All(orderBy: "Id desc").FirstOrDefault();

            if (objList != null)
            {
                string number       = objList.PolicyNumber.Split('-')[0].Substring(4, objList.PolicyNumber.Length - 6);
                long   pNumber      = Convert.ToInt64(number.Substring(2, number.Length - 2)) + 1;
                string policyNumber = string.Empty;
                int    length       = 7;
                length = length - pNumber.ToString().Length;
                for (int i = 0; i < length; i++)
                {
                    policyNumber += "0";
                }
                policyNumber        += pNumber;
                ViewBag.PolicyNumber = "GMCC" + DateTime.Now.Year.ToString().Substring(2, 2) + policyNumber + "-1";
                model.PolicyNumber   = ViewBag.PolicyNumber;
            }
            else
            {
                ViewBag.PolicyNumber = ConfigurationManager.AppSettings["PolicyNumber"] + "-1";
                model.PolicyNumber   = ViewBag.PolicyNumber;
            }

            model.BusinessSourceId = 3;

            return(Mapper.Map <PolicyDetailModel, PolicyDetail>(model));
        }
예제 #7
0
        public ActionResult InsurerEdit(int id, InsurerEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.InsurerID != id)
            {
                ModelState.AddModelError("", "ID Mismatch");
                return(View(model));
            }

            var svc = new InsurerService();

            if (svc.UpdateInsurer(model))
            {
                TempData["SaveResult"] = "The insurer was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "The insurer could not be updated");
            return(View(model));
        }