Example #1
0
        public async Task <bool> AddRole(Role role)
        {
            string validateResult = ValidateRole(role);

            if (!string.IsNullOrEmpty(validateResult))
            {
                throw new ServiceException(new ErrorMessage[]
                {
                    new ErrorMessage()
                    {
                        Code    = string.Empty,
                        Message = validateResult
                    }
                });
            }
            role.Active      = true;
            role.Deleted     = 0;
            role.CreatedDate = System.DateTime.Today;

            _tcContext.Roles.Add(role);
            if (await _tcContext.SaveChangesAsync() > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public async Task <TDto> AddItem(TDto item)
        {
            var entity = _mapper.Map <TEntity>(item);

            await ValidateItem(entity);

            await _dbSet.AddAsync(entity);

            await _tcContext.SaveChangesAsync();

            return(_mapper.Map <TDto>(entity));
        }
Example #3
0
        public async Task <bool> SaveInvoicePostingAsync(InvoicePostingDto invoicePosting)
        {
            var invoiceP = _mapper.Map <InvoicePosting>(invoicePosting);

            _tcContext.InvoicePostings.Add(invoiceP);
            return(await _tcContext.SaveChangesAsync() > 0 ? true : false);
        }
Example #4
0
 public async Task <bool> SaveContextAsync()
 {
     return(await _tcContext.SaveChangesAsync() > 0 ? true : false);
 }
Example #5
0
 public async Task <bool> SaveAllAsync()
 {
     return(await _tcContext.SaveChangesAsync() >= 0);
 }