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