public orderObj salve(orderObj _data) { try { orderModel _model = new orderModel(); if (_data.orderId == 0) { _data = _model.insert(_data); } else { _data = _model.update(_data); } return(_data); } catch (HttpResponseException httpEx) { throw httpEx; } catch (Exception ex) { Log.Error("Falha ao salvar a comanda " + "\r\n" + ex.Message + "\r\n" + ex.Source + "\r\n" + ex.StackTrace); HttpResponseMessage response = new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError); response.ReasonPhrase = "Falha ao salvar a comanda"; throw new HttpResponseException(response); } }