/// <summary> /// get information of customer by id: contains order, addressbook /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult getCustomer(int id) { try { Customer customer = customerService.GetByPrimaryKey(id); if (customer == null) { return(null); } customer.AddressBook = addressBookService.SelectDefaultAddressOfCustomer(id); if (customer.AddressBook != null) { if (customer.AddressBook.CountryID != null) { customer.AddressBook.Country = countryService.GetByPrimaryKey(customer.AddressBook.CountryID.Value); } } customer.TblOrders = orderService.GetByCustomerID(id); return(Json(customer, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { LogService.WriteException(ex); return(null); } }