public async Task <IActionResult> UpdateMeasureUnit(int id, [FromBody] UpdateMeasureUnitCommand command) { command.Id = id; var result = await _mediatr.Send(command); return(result == true ? (IActionResult)Ok() : NotFound()); }
public async Task <bool> UpdateAsync(UpdateMeasureUnitCommand request) { string commandText = $"UPDATE MeasureUnits SET Name = @Name WHERE ID = @Id"; var parameters = new List <SqlParameter> { new SqlParameter("@Name", request.Name), new SqlParameter("@Id", request.Id) }; var result = await _sqlManager.UpdateAsync(commandText, CommandType.Text, parameters); if (result) { await _cacheService .DeleteKeyAsync(RedisDefaultKeys.GetAllMeasureUnits); } return(result); }