public IActionResult EditJob([FromBody] MvEditJob job) { try { var edited = _jobService.EditJob(job); if (!edited) { return(BadRequest()); } return(Ok()); } catch (Exception e) { throw e; } }
public bool EditJob(MvEditJob job) { using (var con = _dah.GetConnection()) { var jsonNew = JsonConvert.SerializeObject(job); var cmd = con.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "SpJobUpd"; cmd.Parameters.Add("@Json", SqlDbType.NChar).Value = jsonNew; cmd.CommandTimeout = _commandTimeout; int rows = cmd.ExecuteNonQuery(); if (rows > 0) { return(true); } return(false); } }