コード例 #1
0
        public async Task <bool> Modify(ProductUnitProduct _model)
        {
            _model.UpdatedUser = scopeContext.UserCode;
            _model.UpdatedDate = DateTime.Now;
            context.Update(_model);
            await context.SaveChangesAsync();

            return(true);
        }
コード例 #2
0
        public async Task <int> Add(ProductUnitProduct _model)
        {
            _model.CreatedUser = scopeContext.UserCode;
            _model.CreatedDate = DateTime.Now;
            context.Add(_model);
            await context.SaveChangesAsync();

            return(_model.Id);
        }
コード例 #3
0
        public async Task <bool> Modify(int _id, ProductUnitProductModel _model)
        {
            ProductUnitProduct entity = await svcProductUnitProduct.GetDetail(_id);

            if (entity == null)
            {
                return(false);
            }
            entity = iMapper.Map(_model, entity);
            return(await svcProductUnitProduct.Modify(entity));
        }
コード例 #4
0
        public async Task <bool> Remove(int _id)
        {
            ProductUnitProduct item = await context.ProductUnitProduct.Where(i => i.Id == _id).FirstOrDefaultAsync();

            if (item == default(ProductUnitProduct))
            {
                return(false);
            }
            item.IsDeleted = true;
            context.Entry(item).Property(x => x.IsDeleted).IsModified = true;
            await context.SaveChangesAsync();

            return(true);
        }
コード例 #5
0
        public async Task <int> Add(ProductUnitProductModel _model)
        {
            ProductUnitProduct entity = iMapper.Map <ProductUnitProduct>(_model);

            return(await svcProductUnitProduct.Add(entity));
        }