Exemplo n.º 1
0
        public IActionResult AddBroker(Broker b, string returnURL)
        {
            var broker = new Broker {
                FirstName          = b.FirstName,
                LastName           = b.LastName,
                Email              = b.Email,
                Type               = b.Type,
                EmailNotifications = b.EmailNotifications,
                Requirements       = new List <KWTask>()
            };

            if (broker.Type == "New Broker" || broker.Type == "Transfer Broker")
            {
                var requirements = broker.CreateRequirementsList();

                foreach (KWTask r in requirements)
                {
                    broker.Requirements.Add(r);
                }
            }


            brokerRepo.AddBroker(broker);
            //TODO: See if there is a way to just close the modal and not refresh the page
            return(Redirect(returnURL));
        }