public int UpdateProduct(Models.Product product)
        {
            //TODO: exception handling

            Database.Product updateItem = new Database.Product()
            {
                Id               = product.Id,
                CategoryId       = product.CategoryId,
                CreatedBy        = GetProductByID(product.Id).CreatedBy,
                CreateDate       = GetProductByID(product.Id).CreateDate,
                LargeImageURL    = product.LargeImageURL,
                LongDescription  = product.LongDescription,
                Name             = product.Name,
                Price            = product.Price,
                Quantity         = product.Quantity,
                ShortDescription = product.ShortDescription,
                SmallImageURL    = product.SmallImageURL,
                UpdateDate       = product.UpdateDate,
                UpdatedBy        = product.UpdatedBy,
            };

            using (var context = new PMSDatabaseEntities())
            {
                context.Entry(updateItem).State = EntityState.Modified;
                context.SaveChanges();
            }
            return(0);
        }
 public ProductRepository()
 {
     _dbContext = new PMSDatabaseEntities();
 }
Exemple #3
0
 public UserRepository()
 {
     _dbContext = new PMSDatabaseEntities();
 }