public bool EditPerson(PersonDTO personDTO) { var _context = new InteractiveDBContext(); var person = new Person(); using (_context) { person.Code = personDTO.Code; person.IdNumber = personDTO.IdNumber; person.Name = personDTO.Name; person.Surname = personDTO.Surname; person.Accounts = (ICollection <DataLayer.Models.Account>)personDTO.Accounts; _context.Persons.Attach(person); _context.Entry(person).State = EntityState.Modified; _context.SaveChanges(); } return(true); }
public bool EditTranstion(TransactionDTO transactionDTO) { var _context = new InteractiveDBContext(); var transaction = new Transaction(); using (_context) { transaction.Code = transactionDTO.Code; transaction.AccountCode = transactionDTO.AccountCode; transaction.Amount = transactionDTO.Amount; transaction.CaptureDate = transactionDTO.CaptureDate; transaction.Description = transactionDTO.Description; _context.Transactions.Attach(transaction); _context.Entry(transaction).State = EntityState.Modified; _context.SaveChanges(); } return(true); }