コード例 #1
0
 /// <summary>
 /// 更新
 /// </summary>
 public static bool Update(SSDto dto)
 {
     using (var DB = new SSMMEntities())
     {
         var model = DB.SS.Find(dto.id);
         if (model != null)
         {
             model.id = dto.id;
             model.t  = dto.t;
             model.u  = dto.u;
             model.d  = dto.d;
             model.transfer_enable = dto.transfer_enable;
             model.port            = dto.port;
             model.password        = dto.password;
             model.@switch         = dto.@switch;
             model.enable          = dto.enable;
             model.isrest          = dto.isrest;
             model.last_rest_time  = dto.last_rest_time;
             model.expiration_time = dto.expiration_time;
             model.create_time     = dto.create_time;
             model.userid          = dto.userid;
         }
         return(DB.SaveChanges() > 0);
     }
 }
コード例 #2
0
 /// <summary>
 /// 添加
 /// </summary>
 public static bool Add(SSDto dto)
 {
     using (var DB = new SSMMEntities())
     {
         DB.SS.Add(new SS()
         {
             id = dto.id,
             t  = dto.t,
             u  = dto.u,
             d  = dto.d,
             transfer_enable = dto.transfer_enable,
             port            = dto.port,
             password        = dto.password,
             @switch         = dto.@switch,
             enable          = dto.enable,
             isrest          = dto.isrest,
             last_rest_time  = dto.last_rest_time,
             expiration_time = dto.expiration_time,
             create_time     = dto.create_time,
             userid          = dto.userid
         });
         return(DB.SaveChanges() > 0);
     }
 }