Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
            }
        }