Esempio n. 1
0
        /// <summary>
        /// the method creates new product
        /// </summary>
        /// <param name="product">New product</param>
        /// <returns></returns>
        public Task <bool> CreateProduct(Models.Product product)
        {
            System.Guid ID     = System.Guid.NewGuid();
            Device      device = buildEntity.EntityModelsDevice(product, ID);
            Product     prod   = buildEntity.EntityModelsProduct(product, ID);
            Image       img    = new Image
            {
                Url       = "/Content/img/" + Path.GetFileName(product.Images.Url),
                refDevice = ID,
            };

            return(Task.FromResult(Repository.Add(prod, device, img)));
        }
Esempio n. 2
0
        public void Add(Host entity)

        {
            _hostrepository.Add(entity);
            SaveChanges();
        }