示例#1
0
 private BaseInfo FillFromReader(SqlDataReader rdr)
 {
     var addressDal = new AddressDAL();
     var result = new BaseInfo {
         Id = (int) rdr["Id"],
         Name = (string) rdr["Name"],
         Address = addressDal.GetAddress((int) rdr["AddressId"])
     };
     return result;
 }
示例#2
0
 public int Add(BaseInfo baseInfo)
 {
     int id = 0;
     using (SqlDataReader rdr = SqlHelper.ExecuteReader(_connString, ADD, baseInfo.Name, baseInfo.Address.Id)) {
         if (rdr.Read()) {
             id = (int) rdr.GetDecimal(0);
         }
     }
     baseInfo.Id = id;
     return id;
 }
 public ActionResult AddBase(string name, string address, string city, string postalCode)
 {
     var baseInfo = new BaseInfo {
         Name = name,
         Address = new AddressInfo {
             Address1 = address,
             City = city,
             ZipCode = postalCode
         }
     };
     _baseBll.Add(baseInfo);
     return RedirectToAction("Index");
 }