Пример #1
0
        public ResultProduct Get(long id)
        {
            var product = this._model.Get(x => x.Id == id);

            var result = new ResultProduct();

            result.Results.Add(product);

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Update of only admin
        /// </summary>
        /// <param name="entry"></param>
        /// <param name="user"></param>
        /// <param name="languageId"></param>
        /// <returns></returns>
        public ResultProduct Update(Product entry, User user, long languageId)
        {
            var result = new ResultProduct {
                Results = null, Error = this._validator.Validate(entry)
            };

            if (!result.Error.IsValid)
            {
                return(result);
            }

            var product = UpdateOfProductLanguage(entry, languageId);

            product.Image = entry.Image;

            // product.Update = entry.Update;

            product.UserUpdate = user;

            this._model.SaveChange();

            return(result);
        }