示例#1
0
        // GET: Broker/Create
        public ActionResult Create()
        {
            var viewModel = new RecordViewModels();

            viewModel.Brokers = repositoryBroker.GetAll();
            return(View(viewModel));
        }
示例#2
0
        public ActionResult Create([Bind(Include = "ProposalId,Insurance,ClientId")] Proposal proposal, int?clientId, int[] Riders)
        {
            var viewModel = new RecordViewModels();

            viewModel.Proposal = proposal;
            if (ModelState.IsValid)
            {
                if (Riders != null)
                {
                    foreach (var RiderId in Riders)
                    {
                        //var rider = repositoryRider.Search(RiderId);
                        // proposal.Riders.Add(rider);
                        repositoryProposal.InsertRider(proposal, RiderId);
                        //repositoryProposal.Save();
                    }
                }
                repositoryProposal.InsertClient(proposal, (int)clientId);
                repositoryProposal.Save();
                //db.Proposals.Add(proposal);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClientId = new SelectList(repositoryClient.GetAll(), "ClientId", "Name", proposal.ClientId);
            return(View(viewModel));
        }
示例#3
0
        // GET: Client/Create
        public ActionResult Create(int?brokerId)
        {
            var viewModel = new RecordViewModels();

            viewModel.Clients = repositoryClient.GetAll();
            ViewBag.BrokerId  = new SelectList(repositoryBroker.GetAll().Where(x => x.BrokerId == brokerId), "BrokerId", "Name");
            return(View(viewModel));
        }
示例#4
0
        // GET: Client
        public ActionResult Index()
        {
            var viewModel = new RecordViewModels();

            viewModel.Clients = repositoryClient.GetAllIncludeBroker();
            //var clients = db.Clients.Include(c => c.Broker);
            return(View(viewModel));
        }
示例#5
0
        // GET: Proposal
        public ActionResult Index()
        {
            var viewModel = new RecordViewModels();

            viewModel.Proposals = repositoryProposal.GetAllIncludeClient();
            //var proposals = db.Proposals.Include(p => p.Client);
            return(View(viewModel));
        }
示例#6
0
        // GET: Proposal/Create
        public ActionResult Create(int?clientId)
        {
            var viewModel = new RecordViewModels();

            viewModel.Proposals = repositoryProposal.GetAll();
            ViewBag.ClientId    = new SelectList(repositoryClient.GetAll().Where(x => x.ClientId == clientId), "ClientId", "Name");
            ViewBag.RiderId     = new MultiSelectList(db.Riders, "RiderId", "RiderName");
            return(View(viewModel));
        }
示例#7
0
        public ActionResult DeleteConfirmed(int id)
        {
            var viewModel = new RecordViewModels();

            viewModel.Proposal = repositoryProposal.Search(id);
            repositoryProposal.Delete(id);
            repositoryProposal.Save();
            //Proposal proposal = db.Proposals.Find(id);
            //db.Proposals.Remove(proposal);
            //db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#8
0
        public ActionResult DeleteConfirmed(int id)
        {
            var viewModel = new RecordViewModels();

            //Broker broker = db.Brokers.Find(id);
            viewModel.Broker = repositoryBroker.Search(id);
            //db.Brokers.Remove(broker);
            //db.SaveChanges();
            repositoryBroker.Delete(id);
            repositoryBroker.Save();
            return(RedirectToAction("Index"));
        }
示例#9
0
        public ActionResult DeleteConfirmed(int id)
        {
            var viewModel = new RecordViewModels();

            viewModel.Client = repositoryClient.Search(id);
            repositoryClient.Delete(id);
            repositoryClient.Save();
            //Client client = db.Clients.Find(id);

            //db.Clients.Remove(client);
            //db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#10
0
        public ActionResult Edit([Bind(Include = "BrokerId,Name,Age")] Broker broker)
        {
            var viewModel = new RecordViewModels();

            viewModel.Broker = broker;
            if (ModelState.IsValid)
            {
                //db.Entry(broker).State = EntityState.Modified;
                //db.SaveChanges();
                repositoryBroker.Update(broker);
                repositoryBroker.Save();
                return(RedirectToAction("Index"));
            }
            return(View(viewModel));
        }
示例#11
0
        // GET: Broker/Details/5
        public ActionResult Details(int?id)
        {
            var viewModel = new RecordViewModels();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            viewModel.Broker = repositoryBroker.Search(id.GetValueOrDefault());
            if (viewModel.Broker == null)
            {
                return(HttpNotFound());
            }
            return(View(viewModel));
        }
示例#12
0
        // GET: Proposal/Details/5
        public ActionResult Details(int?id)
        {
            var viewModel = new RecordViewModels();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Proposal proposal = db.Proposals.Find(id);
            viewModel.Proposal = repositoryProposal.Search(id);
            if (viewModel.Proposal == null)
            {
                return(HttpNotFound());
            }
            return(View(viewModel));
        }
示例#13
0
        // GET: Client/Details/5
        public ActionResult Details(int?id)
        {
            var viewModel = new RecordViewModels();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            // Client client = db.Clients.Find(id);
            viewModel.Client = repositoryClient.Search(id);
            if (viewModel.Client == null)
            {
                return(HttpNotFound());
            }
            return(View(viewModel));
        }
示例#14
0
        // GET: Broker/Edit/5
        public ActionResult Edit(int?id)
        {
            var viewModel = new RecordViewModels();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Broker broker = db.Brokers.Find(id);
            viewModel.Broker = repositoryBroker.Search(id);
            if (viewModel.Broker == null)
            {
                return(HttpNotFound());
            }
            return(View(viewModel));
        }
示例#15
0
        public ActionResult Create([Bind(Include = "BrokerId,Name,Age")] Broker broker)
        {
            var viewModel = new RecordViewModels();

            viewModel.Brokers = repositoryBroker.GetAll();
            if (ModelState.IsValid)
            {
                //db.Brokers.Add(broker);
                //db.SaveChanges();
                repositoryBroker.Insert(broker);
                repositoryBroker.Save();
                return(RedirectToAction("Index"));
            }

            return(View(viewModel));
        }
示例#16
0
        // GET: Client/Edit/5
        public ActionResult Edit(int?id, int?brokerId)
        {
            var viewModel = new RecordViewModels();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Client client = db.Clients.Find(id);
            viewModel.Client = repositoryClient.Search(id);
            if (viewModel.Client == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BrokerId = new SelectList(repositoryBroker.GetAll().Where(x => x.BrokerId == brokerId), "BrokerId", "Name", viewModel.Client.BrokerId);
            return(View(viewModel));
        }
示例#17
0
        // GET: Proposal/Edit/5
        public ActionResult Edit(int?id, int?clientId)
        {
            var viewModel = new RecordViewModels();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Proposal proposal = db.Proposals.Find(id);
            viewModel.Proposal = repositoryProposal.Search(id);
            if (viewModel.Proposal == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClientId = new SelectList(repositoryClient.GetAll(), "ClientId", "Name", viewModel.Proposal.ClientId);
            return(View(viewModel));
        }
示例#18
0
        public ActionResult Edit([Bind(Include = "ProposalId,Insurance,ClientId")] Proposal proposal, int?clientId)
        {
            var viewModel = new RecordViewModels();

            viewModel.Proposal = proposal;
            if (ModelState.IsValid)
            {
                viewModel.Proposal.ClientId = (int)clientId;
                repositoryProposal.Update(proposal);
                repositoryProposal.Save();
                //db.Entry(proposal).State = EntityState.Modified;
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ClientId = new SelectList(repositoryClient.GetAll(), "ClientId", "Name", proposal.ClientId);
            return(View(viewModel));
        }
示例#19
0
        public ActionResult Edit([Bind(Include = "ClientId,Name,BrokerId")] Client client, int?brokerId)
        {
            var viewModel = new RecordViewModels();

            viewModel.Client = client;
            if (ModelState.IsValid)
            {
                //repositoryClient.InsertBroker(client, (int)brokerId);
                viewModel.Client.BrokerId = (int)brokerId;
                repositoryClient.Update(client);
                //db.Entry(client).State = EntityState.Modified;
                //db.SaveChanges();
                repositoryClient.Save();
                return(RedirectToAction("Index"));
            }
            ViewBag.BrokerId = new SelectList(repositoryBroker.GetAll(), "BrokerId", "Name", client.BrokerId);
            return(View(client));
        }
示例#20
0
        public ActionResult Create([Bind(Include = "ClientId,Name,BrokerId")] Client client, int?brokerId)
        {
            var viewModel = new RecordViewModels();

            viewModel.Client = client;
            //var broker = repositoryBroker.Search(brokerId);
            if (ModelState.IsValid)
            {
                //broker.Clients.Add(client);
                repositoryClient.InsertBroker(client, (int)brokerId);
                //repositoryClient.Insert(client);
                repositoryClient.Save();
                return(RedirectToAction("Index"));
            }

            ViewBag.BrokerId = new SelectList(repositoryBroker.GetAll(), "BrokerId", "Name", client.BrokerId);
            return(View(viewModel));
        }