Exemplo n.º 1
0
 public object GetCustomerAddress(CustomerAddress addressObj)
 {
     try
     {
         List <CustomerAddressViewModel> CartList = Mapper.Map <List <CustomerAddress>, List <CustomerAddressViewModel> >(_customerBusiness.GetAllCustomerAddresses(addressObj.CustomerID));
         if (CartList.Count == 0)
         {
             throw new Exception(constants.NoItems);
         }
         return(JsonConvert.SerializeObject(new { Result = true, Records = CartList }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message }));
     }
 }
Exemplo n.º 2
0
 public string GetAllAddressByCustomer(string customerID)
 {
     try
     {
         List <CustomerAddressViewModel> addressList = null;
         if (!string.IsNullOrEmpty(customerID))
         {
             OperationsStatusViewModel operationsStatus = new OperationsStatusViewModel();
             addressList = Mapper.Map <List <CustomerAddress>, List <CustomerAddressViewModel> >(_customerBusiness.GetAllCustomerAddresses(int.Parse(customerID)));
         }
         return(JsonConvert.SerializeObject(new { Result = "OK", Records = addressList }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message }));
     }
 }