public string GetListOfPrinter() { try { List <tb_printer> lstPrinterModel = new List <tb_printer>(); lstPrinterModel = _printerDAO.GetListOfPrinter(); PrinterModel printerModel; List <PrinterModel> lstPrinter = new List <PrinterModel>(); for (int i = 0; i < lstPrinterModel.Count; i++) { printerModel = new PrinterModel(); printerModel.PrinterID = lstPrinterModel[i].printer_id; printerModel.Name = lstPrinterModel[i].name; printerModel.PrinterIP = lstPrinterModel[i].printer_ip; printerModel.PrinterPort = lstPrinterModel[i].printer_port; printerModel.IsActive = lstPrinterModel[i].is_active ?? 0; lstPrinter.Add(printerModel); } return(JsonConvert.SerializeObject(lstPrinter)); } catch (Exception ex) { log.Error("BussicnessLogic => GetListOfLocationTab" + ex.Message); return(null); } }
public int UpdatePrinter(string stringJSON) { try { log.Info("BusinessLogic => UpdatePrinter - Begin"); PrinterModel printerModel = JsonConvert.DeserializeObject <PrinterModel>(stringJSON); return(_printerDAO.UpdatePrinter(printerModel.PrinterID, printerModel.Name)); } catch (Exception ex) { log.Error("BussicnessLogic => UpdatePrinter" + ex.Message); return(-1); } }