public void Delete(PersonDto personDto) { var connection = _session.GetPort<System.Data.Common.DbConnection>(); DagentDatabase db = new DagentDatabase(connection); db.Command<PersonDto>("Person", "PersonId").Delete(personDto); db.ExequteNonQuery("delete from History where PersonId = @personId", new Parameter("personId", personDto.PersonId)); }
public void Update(PersonDto personDto) { var connection = _session.GetPort<System.Data.Common.DbConnection>(); DagentDatabase db = new DagentDatabase(connection); db.Command<PersonDto>("Person", "PersonId").Update(personDto); db.ExequteNonQuery("delete from History where PersonId = @personId", new Parameter("personId", personDto.PersonId)); foreach (HistoryDto historyDto in personDto.HistoryList) { db.Command<HistoryDto>("History", "PersonId", "HistoryNo").Insert(historyDto); } }
public void Insert(PersonDto personDto) { var connection = _session.GetPort<System.Data.Common.DbConnection>(); DagentDatabase db = new DagentDatabase(connection); db.Command<PersonDto>("Person", "PersonId").Insert(personDto); foreach (HistoryDto historyDto in personDto.HistoryList) { db.Command<HistoryDto>("History", "PersonId", "HistoryNo").Insert(historyDto); } }