public IActionResult BrokerEdit(Broker b) { if (b != null) { Broker broker = brokerRepo.GetBrokerByID(b.BrokerID); broker.Email = b.Email; broker.FirstName = b.FirstName; broker.LastName = b.LastName; broker.Status = b.Status; broker.EmailNotifications = b.EmailNotifications; broker.Type = b.Type; int verify = brokerRepo.UpdateBroker(broker); if (verify == 1) { //TODO add feedback of success return(RedirectToAction("Brokers")); } else { //TODO add feedback for error } } else { ModelState.AddModelError("", "Broker Not Found"); } return(View(b)); }
public ActionResult ChangeBroker(string newBroker, int oldBrokerID, int interactionID) { Interaction i = intRepo.GetInteractionById(interactionID); Broker oldB = brokerRepo.GetBrokerByID(oldBrokerID); Broker newB = brokerRepo.GetBrokerByEmail(newBroker); if (i != null && oldB != null && newB != null) { oldB.Interactions.Remove(i); newB.Interactions.Add(i); brokerRepo.UpdateBroker(oldB); brokerRepo.UpdateBroker(newB); return(RedirectToAction("BrokerInteractions", new { BrokerID = oldBrokerID })); } else { ModelState.AddModelError("", "Interaction or broker Not Found"); } return(RedirectToAction("BrokerInteractions", new { BrokerID = oldBrokerID })); }