Esempio n. 1
0
        public async Task <bool> Modify(ProductSubgroup _model)
        {
            _model.UpdatedUser = scopeContext.UserCode;
            _model.UpdatedDate = DateTime.Now;
            context.Update(_model);
            await context.SaveChangesAsync();

            return(true);
        }
Esempio n. 2
0
        public async Task <int> Add(ProductSubgroup _model)
        {
            _model.CreatedUser = scopeContext.UserCode;
            _model.CreatedDate = DateTime.Now;
            context.Add(_model);
            await context.SaveChangesAsync();

            return(_model.Id);
        }
        public async Task <bool> Modify(int _id, ProductSubgroupModel _model)
        {
            ProductSubgroup entity = await svcProductSubgroup.GetDetail(_id);

            if (entity == null)
            {
                return(false);
            }
            entity = iMapper.Map(_model, entity);
            return(await svcProductSubgroup.Modify(entity));
        }
Esempio n. 4
0
        public async Task <bool> Remove(int _id)
        {
            ProductSubgroup item = await context.ProductSubgroup
                                   .Where(i =>
                                          i.Id == _id
                                          ).FirstOrDefaultAsync();

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

            return(true);
        }
        public async Task <int> Add(ProductSubgroupModel _model)
        {
            ProductSubgroup entity = iMapper.Map <ProductSubgroup>(_model);

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