Exemplo n.º 1
0
        public Commons.Dashboard.Customer GetCustomer(Int32 IdCustomer)
        {
            Commons.Dashboard.Customer data = new Commons.Dashboard.Customer();
            IRestResponse WSR = Task.Run(() => apiClient.getJArray("Dashboard/Cliente", "IdCustomer=" + IdCustomer)).Result;

            if (WSR.StatusCode == HttpStatusCode.OK)
            {
                data = JObject.Parse(WSR.Content).ToObject <Commons.Dashboard.Customer>();
            }

            return(data);
        }
        public static Commons.Dashboard.Customer GetCustomer(Int32 IdCustomer)
        {
            Commons.Dashboard.Customer obj = new Commons.Dashboard.Customer();
            using (IndexEntities db = new IndexEntities())
            {
                spg_DashboardCustomer_Result result = db.spg_DashboardCustomer(IdCustomer).FirstOrDefault();
                obj.IdPerson = result.IdPerson;
                obj.EndDate  = (DateTime)result.BondEndDate;
                obj.Days     = (Int32)result.Days;
                obj.Label    = result.Label;
            }

            return(obj);
        }
        public HttpResponseMessage GetCustomer(Int32 IdCustomer)
        {
            HttpResponseMessage respuesta = null;

            try
            {
                Commons.Dashboard.Customer result = Dal.Dashboard.GetCustomer(IdCustomer);
                respuesta = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }