Exemplo n.º 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);
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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());
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int EditStocks(Zfdx_DevicesModel model)
 {
     return(dal.EditStocks(model));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddStocks(Zfdx_DevicesModel model)
 {
     return(dal.AddStocks(model));
 }