Exemplo n.º 1
0
 public ContactInfoModel(IContactInfo data)
 {
     this.Id             = data.ContactInfoId;
     this.Uid            = data.ContactInfoUid;
     this.Title          = data.Title;
     this.FirstName      = data.FirstName;
     this.LastName       = data.LastName;
     this.City           = data.City;
     this.Country        = CountryModel.Load(data.CountryId);
     this.DateCreated    = data.DateCreated;
     this.Addresses      = data.Addresses.Select(a_ => new AddressModel(a_)).ToList();
     this.EmailAddresses = data.EmailAddresses.Select(e_ => new EmailModel(e_)).ToList();
     this.PhoneNumbers   = data.PhoneNumbers.Select(p_ => new PhoneNumberModel(p_)).ToList();
 }
        public async Task <ActionResult> Country(long countryId)
        {
            JsonResult result = null;

            try
            {
                var model = new CountryModel();
                await model.Load(AirportBusinessService, countryId);

                var view = await ControllerContext.RenderRazorViewToString("_CountryInformation", model);

                var data = new { Airports = model.Country.Airports, Html = view };

                result = Json(data);
            }
            catch (Exception exception)
            {
                var data = new { Html = exception.Message };
                result = Json(data);
            }

            return(result);
        }