public static NetClientModel ToModel(this NetClient dto)
        {
            NetClientModel result = new NetClientModel();

            result.Id              = dto.Id;
            result.ClientName      = dto.ClientLogInName;
            result.IsConnected     = dto.IsConnected;
            result.Password        = dto.Password;
            result.NetClientTypeId = dto.NetClientTypeId;
            return(result);
        }
Example #2
0
 public JsonResult Delete(NetClientModel model)
 {
     try
     {
         var dbItem = this.netClientRepository.Read(model.Id);
         this.netClientRepository.Delete(dbItem);
         return(Json(new { success = true }));
     }
     catch
     {
         throw;
     }
 }
Example #3
0
 public JsonResult Update(NetClientModel model)
 {
     try
     {
         var dbmodel = this.netClientRepository.Read(m => m.Id == model.Id).First();
         dbmodel.Password        = model.Password;
         dbmodel.IsConnected     = model.IsConnected;
         dbmodel.ClientLogInName = model.ClientName;
         this.netClientRepository.Update(dbmodel);
         return(Json(dbmodel.ToModel()));
     }
     catch
     {
         throw;
     }
 }