Exemplo n.º 1
0
 public void Update(AgencyDal agency)
 {
     using (var conn = Database.GetConnection())
     {
         conn.Execute("update law_enforcement set agency=@name where id=@id;", new { id = agency.Id, name = agency.Agency });
     }
 }
Exemplo n.º 2
0
 public int Insert(AgencyDal agency)
 {
     using (var conn = Database.GetConnection())
     {
         conn.Execute("insert into law_enforcement (agency) values (@name);", new { name = agency.Agency });
         var result = conn.Query <AgencyDal>("select id, agency from law_enforcement where agency=@name;", new { Name = agency.Agency }).FirstOrDefault();
         return(result == null ? -1 : result.Id);
     }
 }
        protected override void DataPortal_Update()
        {
            var dal = new Dal.LawEnforcement();

            using (BypassPropertyChecks)
            {
                var data = new Dal.AgencyDal {
                    Id = Id, Agency = Agency
                };
                dal.Update(data);
            }
        }
        protected override void DataPortal_Insert()
        {
            var dal = new Dal.LawEnforcement();

            using (BypassPropertyChecks)
            {
                var data = new Dal.AgencyDal {
                    Agency = Agency
                };
                var newId = dal.Insert(data);
                Id = newId;
            }
        }