示例#1
0
        public ActionResult EditGunPurchase(int gpId = 9)
        {
            string      query = "select * from shooters.gunPurchase where gpid = " + gpId;
            gunPurchase gp    = TableUtils.queryToObject <gunPurchase>(query);

            return(View(gp));
        }
示例#2
0
        public ActionResult CommitGPChanges(gunPurchase g)
        {
            gunSeller _obj = TableUtils.queryToObject <gunSeller>("select * from shooters.gunSeller where sName = '" + g.sName + "'");

            if (_obj.sName == null)
            {
                //if seller does not exist in sellers, create it.
                QueryUtils.query("insert into shooters.gunSeller (sName) values ('" + g.sName + "')");
            }

            string query = "update shooters.gunPurchase" +
                           " set sName = '" + g.sName + "'," +
                           "  gpDate = '" + g.gpDate + "'," +
                           "  gpCost = '" + g.gpCost + "'," +
                           "  gName = '" + g.gName + "'," +
                           "  gpDesc = '" + g.gpDesc + "'" +
                           " where gpId = '" + g.gpId + "'";

            setSuccess(QueryUtils.query(query));
            return(RedirectToAction("Guns"));
        }