public IActionResult UpdateSales([FromBody] MvSalesUpdate sales) { try { var updated = _salesService.UpdateSales(sales); if (!updated) { return(BadRequest()); } return(Ok()); } catch (Exception e) { throw e; } }
public bool UpdateSales(MvSalesUpdate salesUpdate) { using (var connection = _dah.GetConnection()) { var jsonNew = JsonConvert.SerializeObject(salesUpdate); var command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "SpSalesTransactionUpd"; command.Parameters.Add("@json", SqlDbType.NChar).Value = jsonNew; command.CommandTimeout = _comdTimeout; int rows = command.ExecuteNonQuery(); if (rows > 0) { return(true); } return(false); } }