public async Task<bool> AdicionarAsync(Emprestimo emprestimo) { this.DBKitap.Emprestimos.Add(emprestimo); await this.DBKitap.SaveChangesAsync(); return true; }
public async Task<bool> AlterarAsync(Emprestimo emprestimo) { Emprestimo emprestimoToUpdate = this.DBKitap.Emprestimos.Where(e => e.ID == emprestimo.ID).FirstOrDefault<Emprestimo>(); emprestimoToUpdate.Duracao = emprestimo.Duracao; emprestimoToUpdate.OperacaoDeEntrega = emprestimo.OperacaoDeEntrega; emprestimoToUpdate.OperacaoDeDevolucao = emprestimo.OperacaoDeDevolucao; emprestimoToUpdate.Status = emprestimo.Status; await this.DBKitap.SaveChangesAsync(); return true; }