public async Task <bool> Activate(int id) { var resultUser = await ObtainUserAsync(id); resultUser.Condition = true; try { return(await _context.SaveChangesAsync() > 0 ? true : false); } catch (Exception ex) { return(false); } }
public async Task <Sale> AddSale(Sale sale) { sale.status = "ACCEPTED"; sale.date_time = DateTime.Now; _context.Sales.Add(sale); try { await _context.SaveChangesAsync(); } catch (Exception ex) { return(null); } return(sale); }
public async Task <Entry> AddEntry(Entry entry) { entry.status = "ACCEPTED"; entry.date_time = DateTime.Now; _context.Entries.Add(entry); try { await _context.SaveChangesAsync(); } catch (Exception ex) { return(null); } return(entry); }
public async Task <bool> Update(Person person) { var resultPerson = await ObtainPersonAsync(person.IdPerson); resultPerson.Name = person.Name; resultPerson.Type_document = person.Type_document; resultPerson.Type_person = person.Type_person; resultPerson.Email = person.Email; resultPerson.Phone = person.Phone; resultPerson.Num_document = person.Num_document; resultPerson.Address = person.Address; try { return(await _context.SaveChangesAsync() > 0 ? true : false); } catch (Exception ex) { return(false); } }