Ejemplo n.º 1
0
 // POST /Api/Message/SaveMessage
 public void SaveMessage([FromBody]CustomerMessage message)
 {
     var dataMessage = new DataAccess.CustomerMessage
     {
         From = new DataAccess.Customer
         {
             Id = message.From.Id,
             Name = message.From.Name
         },
         To = message.To,
         Text = message.Text
     };
     _business.SaveMessage(dataMessage);
 }
Ejemplo n.º 2
0
        public IEnumerable<CustomerMessage> ListMessages([FromBody]Customer customer)
        {
            var dataMessage = new DataAccess.CustomerMessage { From = new DataAccess.Customer { Id = customer.Id, Name = customer.Name } };

            var response = _business.ListMessages(dataMessage.From);

            return from r in response
                   select new CustomerMessage
                   {
                       From = new Customer { Id = r.From.Id, Name = r.From.Name },
                       To = r.To,
                       Text = r.Text
                   };
        }