Esempio n. 1
0
        public JsonResult <Models.Product> GetProduct(int id)
        {
            EntityMapper <Lab12_DataAccessLayer.Product, Models.Product> mapObj = new EntityMapper <Lab12_DataAccessLayer.Product, Models.Product>();

            Lab12_DataAccessLayer.Product dalProduct = DAL.GetProduct(id);
            Models.Product products = new Models.Product();
            products = mapObj.Translate(dalProduct);
            return(Json <Models.Product>(products));
        }
Esempio n. 2
0
        public bool UpdateProduct(Models.Product product)
        {
            EntityMapper <Models.Product, Lab12_DataAccessLayer.Product> mapObj = new EntityMapper <Models.Product, Lab12_DataAccessLayer.Product>();

            Lab12_DataAccessLayer.Product productObj = new Lab12_DataAccessLayer.Product();
            productObj = mapObj.Translate(product);
            var status = DAL.UpdateProduct(productObj);

            return(status);
        }
Esempio n. 3
0
        public bool InsertProduct(Models.Product product)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                EntityMapper <Models.Product, Lab12_DataAccessLayer.Product> mapObj = new EntityMapper <Models.Product, Lab12_DataAccessLayer.Product>();
                Lab12_DataAccessLayer.Product productObj = new Lab12_DataAccessLayer.Product();
                productObj = mapObj.Translate(product);
                status     = DAL.InsertProduct(productObj);
            }
            return(status);
        }