Exemplo n.º 1
0
 public async Task <IActionResult> UpdateAsync(ContiBancariModel conto)
 {
     if (await InvService.UpdateAsync(conto).ConfigureAwait(false))
     {
         return(Ok());
     }
     else
     {
         return(BadRequest());
     }
 }
Exemplo n.º 2
0
        public async Task <bool> UpdateAsync(ContiBancariModel conto)
        {
            try
            {
                DbContext.ContiBancari.Update(conto);
                await DbContext.SaveChangesAsync().ConfigureAwait(false);

                return(true);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public async Task <bool> DeleteContoAsync(int id)
        {
            if (await DbContext.ContiBancari.AnyAsync(c => c.Id == id).ConfigureAwait(false))
            {
                ContiBancariModel conto = await DbContext.ContiBancari
                                          .Where(c => c.Id == id)
                                          .FirstAsync()
                                          .ConfigureAwait(false);

                DbContext.ContiBancari.Remove(conto);

                await DbContext
                .SaveChangesAsync()
                .ConfigureAwait(false);

                return(true);
            }
            return(false);
        }
Exemplo n.º 4
0
        public async Task <bool> AddAsync(ContiBancariModel conto)
        {
            if (conto.CliforModelId > 0 && conto.IBAN != null)
            {
                try
                {
                    DbContext.ContiBancari.Add(conto);
                    await DbContext.SaveChangesAsync().ConfigureAwait(false);

                    return(true);
                }
                catch (System.Exception)
                {
                    return(false);
                }
            }

            return(false);
        }