Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        public  static void MakeProjection(ProductRigid from, ProductRigidApi to)
        {
            
            var part = from.ProductParts.FirstOrDefault();
            var material = part.ProductPartPrintableArticles.FirstOrDefault();

            to.Format = from.Format;
            to.TypeOfMaterial = material.TypeOfMaterial;
            to.NameOfMaterial = material.NameOfMaterial;
            to.Color = material.Color;
            to.Weight = material.Weight;

        }
Esempio n. 2
0
        public static void ResolveProjection(ProductRigidApi from,  ProductRigid to)
        {

            var part = to.ProductParts.FirstOrDefault();
            var material = part.ProductPartPrintableArticles.FirstOrDefault();

            to.Format = from.Format;
            material.TypeOfMaterial = from.TypeOfMaterial;
            material.NameOfMaterial = from.NameOfMaterial;
            material.Color = from.Color;
            material.Weight = from.Weight;

        }
Esempio n. 3
0
        public HttpResponseMessage GetEmptyRigid(string id)
        {
            try
            {
                PapiroService papiro = new PapiroService();
                //Initialize new product
                PapiroMVC.Models.ProductRigid prodIntero = (ProductRigid)papiro.InitProduct(id, new ProductTaskNameRepository(), new FormatsNameRepository(), new TypeOfTaskRepository());

                var prod = new ProductRigidApi();
                prod.Id = id;

                Projection.MakeProjection(prodIntero, prod);

                return Request.CreateResponse<ProductRigidApi>(HttpStatusCode.OK, prod);
            }
            catch (Exception)
            {
                return Request.CreateResponse(HttpStatusCode.InternalServerError);
            }
        }