示例#1
0
        public IHttpActionResult UpdateCount(UpdateAddCountDTO model)
        {
            var result = productService.ChangeItemCount(model);

            if (!result.Success)
            {
                return(BadRequest());
            }
            return(Ok());
        }
示例#2
0
        public IResult ChangeItemCount(UpdateAddCountDTO model)
        {
            var result = new Result();

            try
            {
                var instance = repository.Get(x => x.Id == model.Id);
                instance.AddCount = model.AddCount;
                repository.Update(instance);
                result.Success = true;
            }
            catch (Exception e)
            {
                result.Message = e.ToString();
            }
            return(result);
        }