コード例 #1
0
        public HttpResponseMessage EditStocks(Zfdx_DevicesModel model)
        {
            int success = b.EditStocks(model);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            if (success > 0)
            {
                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            else
            {
                response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
コード例 #2
0
 /// <summary>
 /// 设备新增
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddStocks(Zfdx_DevicesModel model)
 {
     using (Entities db = new Entities()){
         zfdx_devices newmodel = new zfdx_devices();
         newmodel.deviceid     = model.deviceid;
         newmodel.devicename   = model.devicename;
         newmodel.brand        = model.brand;
         newmodel.model        = model.model;
         newmodel.jldw         = model.jldw;
         newmodel.devicetype   = model.devicetype;
         newmodel.remark       = model.remark;
         newmodel.createuserid = model.createuserid;
         newmodel.createtime   = model.createtime;
         newmodel.updatetime   = DateTime.Now;
         db.zfdx_devices.Add(newmodel);
         db.SaveChanges();
         return(newmodel.deviceid);
     }
 }
コード例 #3
0
 /// <summary>
 /// 修改设备
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int EditStocks(Zfdx_DevicesModel model)
 {
     using (Entities db = new Entities()){
         zfdx_devices newmodel = db.zfdx_devices.FirstOrDefault(a => a.deviceid == model.deviceid);
         if (newmodel != null)
         {
             newmodel.deviceid     = model.deviceid;
             newmodel.devicename   = model.devicename;
             newmodel.brand        = model.brand;
             newmodel.model        = model.model;
             newmodel.jldw         = model.jldw;
             newmodel.devicetype   = model.devicetype;
             newmodel.remark       = model.remark;
             newmodel.createuserid = model.createuserid;
             newmodel.createtime   = model.createtime;
             newmodel.updatetime   = DateTime.Now;
         }
         return(db.SaveChanges());
     }
 }
コード例 #4
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int EditStocks(Zfdx_DevicesModel model)
 {
     return(dal.EditStocks(model));
 }
コード例 #5
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddStocks(Zfdx_DevicesModel model)
 {
     return(dal.AddStocks(model));
 }