Esempio n. 1
0
        public void UpdatingAgentS()
        {
            Response response      = new Response();
            var      agentToUpdate = AGENT1;

            repo.Insert(agentToUpdate);

            agentToUpdate.FirstName = "Ghost";
            response = repo.Update(agentToUpdate);

            Assert.IsTrue(response.Success);
        }
Esempio n. 2
0
        public Agent Update(Agent agent)
        {
            try
            {
                agentRepo.Update(agent);
            }
            catch (NotSupportedException ex)
            {
                throw new FailedOperationException("Failed to update Agent.", ex);
            }

            return(null);
        }
        public ActionResult Edit(int agentId, EditAgent agent)
        {
            AgentRepository repository = new AgentRepository();

            Agents agentToUpdate = new Agents
            {
                id        = agent.agentId,
                Contracts = repository.GetById(agentId).Contracts,
                name      = agent.agentName
            };

            repository.Update(agentToUpdate);
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(int agentId, EditAgent agent)
        {
            AgentRepository repository = new AgentRepository();

            Agents agentToUpdate = new Agents
            {
                id = agent.agentId,
                Contracts = repository.GetById(agentId).Contracts,
                name = agent.agentName
            };

            repository.Update(agentToUpdate);
            return RedirectToAction("Index");
        }