Exemplo n.º 1
0
        public ActionResult View(Agency model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var agencyBusiness = new AgencyBusiness();

                    agencyBusiness.SaveAgency(model);
                }

                return(View("View", model));
            }
            catch (Exception ex)
            {
                Functions.EventHandler(ex, "View(Agency)");
                return(View("Agencies"));
            }
        }
Exemplo n.º 2
0
        public ActionResult Create(Agency model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var mod            = new List <Agency>();
                    var AgencyBusiness = new AgencyBusiness();
                    var service        = new CRM.CRMService.CRMServiceClient();

                    //string agencyStatus = string.Empty;

                    //if (service != null)
                    //    agencyStatus = service.GetAgencyStatus(0);

                    Agency Agency = new Agency
                    {
                        Name = model.Name
                    };

                    AgencyBusiness.SaveAgency(Agency);

                    mod.Add(Agency);

                    return(View("Agencies", new AgencyBusiness().LoadAgencys()));
                }
                else
                {
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                Functions.EventHandler(ex, " Create(Agency)");
                return(View(model));
            }
        }