Ejemplo n.º 1
0
        public IActionResult GetCustomProduct(string id)
        {
            ViewModels.CustomProduct result = null;

            if (!string.IsNullOrEmpty(id) && Guid.TryParse(id, out Guid customProductGuid))
            {
                // query the Dynamics system to get the contact record.
                MicrosoftDynamicsCRMbcgovCustomproduct contact = _dynamicsClient.GetCustomProductById(customProductGuid);

                if (contact != null)
                {
                    result = contact.ToViewModel();
                }
                else
                {
                    return(new NotFoundResult());
                }
            }
            else
            {
                return(BadRequest());
            }

            return(Json(result));
        }