コード例 #1
0
        public void Insert(Core.Domain.Tank model)
        {
            db = new SqlConnection(ConfigurationManager.ConnectionStrings["cnConsumption"].ConnectionString);
            string sql = " INSERT INTO tblTank(Name) " +
                         " VALUES (@Name)";

            db.Execute(sql, new
            {
                model.Name
            });
            db.Close();
        }
コード例 #2
0
        public void Update(Core.Domain.Tank model)
        {
            db = new SqlConnection(ConfigurationManager.ConnectionStrings["cnConsumption"].ConnectionString);
            string sql = " Update tblBrand Set Name=@Name Where id=@ID";

            db.Execute(sql, new
            {
                model.Name,
                model.ID
            });

            db.Close();
        }
コード例 #3
0
 public ActionResult Add(Core.Domain.Tank model)
 {
     _TankService = new TankService();
     _TankService.InsertTank(model);
     return(RedirectToAction("Index"));
 }
コード例 #4
0
 public ActionResult Edit(Core.Domain.Tank Model)
 {
     _TankService = new TankService();
     _TankService.Update(Model);
     return(RedirectToAction("Index"));
 }