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); } }
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)); }
public async Task <bool> SaveInvoicePostingAsync(InvoicePostingDto invoicePosting) { var invoiceP = _mapper.Map <InvoicePosting>(invoicePosting); _tcContext.InvoicePostings.Add(invoiceP); return(await _tcContext.SaveChangesAsync() > 0 ? true : false); }
public async Task <bool> SaveContextAsync() { return(await _tcContext.SaveChangesAsync() > 0 ? true : false); }
public async Task <bool> SaveAllAsync() { return(await _tcContext.SaveChangesAsync() >= 0); }