Example #1
0
        public async Task <IActionResult> AddPrinter([FromBody] ClientPrinter printer)
        {
            printer.BusinessId = Business.ID;
            await Service.AddAsync(printer);

            return(Json(printer));
        }
Example #2
0
        public async Task <IActionResult> UpdatePrinterProducts([FromBody] ClientPrinter printer)
        {
            var count = await Service.UpdateAsync(printer, new[] { nameof(printer.FoodIds) });

            return(Json(new JsonData {
                Success = true, Msg = "关联成功"
            }));
        }
Example #3
0
        public async Task <IActionResult> UpdatePrinter([FromBody] ClientPrinter printer)
        {
            var count = await Service.UpdateAsync(printer, new List <string> {
                nameof(printer.Name), nameof(printer.IP), nameof(printer.Port), nameof(printer.Type), nameof(printer.State), nameof(printer.Quantity), nameof(printer.Mode), nameof(printer.Format), nameof(printer.Scope), nameof(printer.CashierName)
            });

            Log.Info($"门店{Business.Name}中的打印机{printer.Name}更新,更新后状态{printer.State}");
            return(Json(new JsonData {
                Success = true, Msg = "更新成功"
            }));
        }
Example #4
0
        /// <summary>
        /// 保存客户端打印机设置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult SavePrinter(int id, [FromBody] ClientPrinter printer, [FromServices] IBusinessRepository service)
        {
            var result = new JsonData();

            printer.BusinessId = id;
            try
            {
                printer.Scope = ActionScope.Takeout;
                service.SavePrinter(printer);
                result.Success = true;
                result.Msg     = "成功";
                result.Data    = printer;
            }
            catch (Exception ex)
            {
                result.Msg = ex.Message;
            }
            return(Json(result));
        }