public ActionResult UpdateAgentData(Models.MaintenanceAgentProfile.AgentModel AgentProfileModel, List <Models.MaintenanceAgentProfile.AgentAddress> AgentAddress, string AgentProfileID)
 {
     if (AgentAddress == null)
     {
         AgentAddress = new List <Models.MaintenanceAgentProfile.AgentAddress>();
     }
     foreach (Models.MaintenanceAgentProfile.AgentAddress address in AgentAddress)
     {
         AgentProfileModel.AgentAddress.Add(address);
     }
     Mapper.CreateMap <Models.MaintenanceAgentProfile.AgentAddress, BusinessObjects.AgentAddress>();
     Mapper.CreateMap <Models.MaintenanceAgentProfile.AgentProfile, BusinessObjects.AgentProfile>();
     Mapper.CreateMap <Models.MaintenanceAgentProfile.AgentModel, BusinessObjects.AgentModel>();
     BusinessObjects.AgentModel aModel = Mapper.Map <Models.MaintenanceAgentProfile.AgentModel, BusinessObjects.AgentModel>(AgentProfileModel);
     return(Content(service.UpdateAgentData("Update", aModel, AgentProfileID).ToString()));
 }
        public ActionResult AddAgentData(Models.MaintenanceAgentProfile.AgentModel AgentProfileModel, List <Models.MaintenanceAgentProfile.AgentAddress> AgentAddress, string AgentProfileID)
        {
            if (AgentAddress == null)
            {
                AgentAddress = new List <Models.MaintenanceAgentProfile.AgentAddress>();
            }
            foreach (Models.MaintenanceAgentProfile.AgentAddress address in AgentAddress)
            {
                AgentProfileModel.AgentAddress.Add(address);
            }
            Mapper.CreateMap <Models.MaintenanceAgentProfile.AgentAddress, BusinessObjects.AgentAddress>();
            Mapper.CreateMap <Models.MaintenanceAgentProfile.AgentProfile, BusinessObjects.AgentProfile>();
            Mapper.CreateMap <Models.MaintenanceAgentProfile.AgentModel, BusinessObjects.AgentModel>();
            BusinessObjects.AgentModel          aModel  = Mapper.Map <Models.MaintenanceAgentProfile.AgentModel, BusinessObjects.AgentModel>(AgentProfileModel);
            List <Dictionary <string, object> > session = (List <Dictionary <string, object> >)Session["loginDetails"];
            string UserID = session[0]["ID"].ToString();

            aModel.AgentProfile.PreparedByID       = UserID;
            aModel.AgentProfile.DocumentStatusCode = "7";
            aModel.AgentProfile.Permission         = "65541";
            return(Content(service.UpdateAgentData("Add", aModel, AgentProfileID).ToString()));
        }