예제 #1
0
        public ActionResult ComplaintCreate()
        {
            var service = new ComplaintService();
            var model   = new ComplaintCreate
            {
                InvestigatorList = service.GetAllInvestigators(),
                AdminList        = service.GetAllAdmin(),
                AgentList        = service.GetAllAgents(),
                InsurerList      = service.GetAllInsurer(),
                ConsumerList     = service.GetAllConsumer()
            };

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

            var service = new ComplaintService();

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

            ModelState.AddModelError("", "The Complaint could not be created.");
            return(View(model));
        }
예제 #3
0
        public bool ComplaintCreate(ComplaintCreate model)
        {
            var entity =
                new Complaint()
            {
                InvestigatorID = model.InvestigatorID,
                AdminActionID  = model.AdminActionID,
                AgentID        = model.AgentID,
                InsurerID      = model.InsurerID,
                ConsumerID     = model.ConsumerID,
                ComplaintDesc  = model.ComplaintDesc,
                Resolved       = model.Resolved,
                DateSubmitted  = model.DateSubmitted,
                DateCompleted  = model.DateCompleted
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Complaints.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }